Linux Sound subsystem development
 help / color / mirror / Atom feed
* [PATCH] ALSA: us144mkii: Do not submit a MIDI URB when there is no data
@ 2026-11-29  7:27 Arina Kharlamova via B4 Relay
  2026-12-01  7:53 ` Takashi Iwai
  0 siblings, 1 reply; 2+ messages in thread
From: Arina Kharlamova via B4 Relay @ 2026-11-29  7:27 UTC (permalink / raw)
  To: Jaroslav Kysela, Takashi Iwai, Šerif Rami
  Cc: Takashi Iwai, linux-sound, stable, Arina Kharlamova

From: Arina Kharlamova <arina.kharlamova@mbzuai.ac.ae>

In tascam_midi_out_work_handler() the "No more data" break sits inside
scoped_guard(), so it only leaves the guarded block and not the while
loop. The URB is then anchored and submitted with the previous buffer
contents and length, without its bit set in midi_out_urbs_in_flight.

Return from the handler instead, as the "no free URBs" case already
does. The guard drops the lock on return.

Fixes: 67afec157fe6 ("ALSA: usb-audio: us144mkii: Add MIDI support and mixer controls")
Cc: stable@vger.kernel.org
Signed-off-by: Arina Kharlamova <arina.kharlamova@mbzuai.ac.ae>
---
Found by checks derived from the spec2patch kernel API specifications,
with the help of an AI coding assistant (Claude); I reviewed the
analysis and the fix.
---
 sound/usb/usx2y/us144mkii_midi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/usb/usx2y/us144mkii_midi.c b/sound/usb/usx2y/us144mkii_midi.c
index 4871797b1670..15299c27dad8 100644
--- a/sound/usb/usx2y/us144mkii_midi.c
+++ b/sound/usb/usx2y/us144mkii_midi.c
@@ -252,7 +252,7 @@ static void tascam_midi_out_work_handler(struct work_struct *work)
 			bytes_to_send = snd_rawmidi_transmit(substream, buf, 8);
 
 			if (bytes_to_send <= 0)
-				break; /* No more data */
+				return; /* No more data */
 
 			if (bytes_to_send < 9)
 				memset(buf + bytes_to_send, 0xfd,

---
base-commit: 25faec9ce61c01fb45abf812a222c5b43c3cd5c5
change-id: 20261129-s2p-c02-10a2009435a8

Best regards,
--  
Arina Kharlamova <arina.kharlamova@mbzuai.ac.ae>



^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-12-01  7:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-29  7:27 [PATCH] ALSA: us144mkii: Do not submit a MIDI URB when there is no data Arina Kharlamova via B4 Relay
2026-12-01  7:53 ` Takashi Iwai

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox