Skip to content

Commit 8293705

Browse files
tiwaigregkh
authored andcommitted
usb: gadget: midi2: Fix interpretation of is_midi1 bits
The UMP Function Block info m1.0 field (represented by is_midi1 sysfs entry) is an enumeration from 0 to 2, while the midi2 gadget driver incorrectly copies it to the corresponding snd_ump_block_info.flags bits as-is. This made the wrong bit flags set when m1.0 = 2. This patch corrects the wrong interpretation of is_midi1 bits. Fixes: 29ee7a4 ("usb: gadget: midi2: Add configfs support") Cc: [email protected] Signed-off-by: Takashi Iwai <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent a4faee0 commit 8293705

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

drivers/usb/gadget/function/f_midi2.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1591,7 +1591,11 @@ static int f_midi2_create_card(struct f_midi2 *midi2)
15911591
fb->info.midi_ci_version = b->midi_ci_version;
15921592
fb->info.ui_hint = reverse_dir(b->ui_hint);
15931593
fb->info.sysex8_streams = b->sysex8_streams;
1594-
fb->info.flags |= b->is_midi1;
1594+
if (b->is_midi1 < 2)
1595+
fb->info.flags |= b->is_midi1;
1596+
else
1597+
fb->info.flags |= SNDRV_UMP_BLOCK_IS_MIDI1 |
1598+
SNDRV_UMP_BLOCK_IS_LOWSPEED;
15951599
strscpy(fb->info.name, ump_fb_name(b),
15961600
sizeof(fb->info.name));
15971601
}

0 commit comments

Comments
 (0)