Bug 261071

Summary: snd_midi: unit 0 cannot have 2 or more channels
Product: Base System Reporter: masatic.bsd
Component: kernAssignee: freebsd-bugs (Nobody) <bugs>
Status: New ---    
Severity: Affects Only Me    
Priority: ---    
Version: 13.0-RELEASE   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
patch, for 13.0-Release-p4 none

Description masatic.bsd 2022-01-10 03:30:28 UTC
Created attachment 230855 [details]
patch, for 13.0-Release-p4

midi_init uses 0 as auto-allocate unit number, but unit 0 is also a valid unit number.
This confliction makes secondary function call to allocate another channel for unit 0 is treated as auto-allocate and returns non-0 unit as result incorrectly.
Attached patch fixes this problem, auto-allocate number is changed from 0 to -1.