* [STABLE v6.1-v5.15] ALSA: usb-audio: Don't try to submit URBs after disconnection
@ 2026-11-09 9:03 Lee Jones
0 siblings, 0 replies; only message in thread
From: Lee Jones @ 2026-11-09 9:03 UTC (permalink / raw)
To: lee, Jaroslav Kysela, Takashi Iwai, alsa-devel, linux-kernel
Cc: stable, Takashi Iwai
From: Takashi Iwai <tiwai@suse.de>
commit ab574d1629552b6831cd91b926b38092c15d6142 upstream.
USB-audio driver can still submit URBs while the device is being
disconnected, and it may result in spurious error messages like:
usb 1-2: cannot submit urb (err = -19)
usb 1-2: Unable to submit urb #0: -19 at snd_usb_queue_pending_output_urbs
usb 1-2: cannot submit urb 0, error -19: no device
Although those are harmless, they are just ugly.
This patch tries to avoid spewing such error messages when the device
is already at the disconnected state. It also skips the superfluous
xfer notification, too.
Link: https://lore.kernel.org/r/20230828101924.27107-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Lee Jones <lee@kernel.org>
---
sound/usb/endpoint.c | 40 +++++++++++++++++++++++++++-------------
1 file changed, 27 insertions(+), 13 deletions(-)
diff --git a/sound/usb/endpoint.c b/sound/usb/endpoint.c
index dd81c94cbb52..167eefc14d82 100644
--- a/sound/usb/endpoint.c
+++ b/sound/usb/endpoint.c
@@ -520,13 +520,18 @@ int snd_usb_queue_pending_output_urbs(struct snd_usb_endpoint *ep,
return -EPIPE;
}
- err = usb_submit_urb(ctx->urb, GFP_ATOMIC);
+ if (!atomic_read(&ep->chip->shutdown))
+ err = usb_submit_urb(ctx->urb, GFP_ATOMIC);
+ else
+ err = -ENODEV;
if (err < 0) {
- usb_audio_err(ep->chip,
- "Unable to submit urb #%d: %d at %s\n",
- ctx->index, err, __func__);
- if (!in_stream_lock)
- notify_xrun(ep);
+ if (!atomic_read(&ep->chip->shutdown)) {
+ usb_audio_err(ep->chip,
+ "Unable to submit urb #%d: %d at %s\n",
+ ctx->index, err, __func__);
+ if (!in_stream_lock)
+ notify_xrun(ep);
+ }
return -EPIPE;
}
@@ -593,12 +598,17 @@ static void snd_complete_urb(struct urb *urb)
prepare_inbound_urb(ep, ctx);
}
- err = usb_submit_urb(urb, GFP_ATOMIC);
+ if (!atomic_read(&ep->chip->shutdown))
+ err = usb_submit_urb(urb, GFP_ATOMIC);
+ else
+ err = -ENODEV;
if (err == 0)
return;
- usb_audio_err(ep->chip, "cannot submit urb (err = %d)\n", err);
- notify_xrun(ep);
+ if (!atomic_read(&ep->chip->shutdown)) {
+ usb_audio_err(ep->chip, "cannot submit urb (err = %d)\n", err);
+ notify_xrun(ep);
+ }
exit_clear:
clear_bit(ctx->index, &ep->active_mask);
@@ -1646,11 +1656,15 @@ int snd_usb_endpoint_start(struct snd_usb_endpoint *ep)
goto __error;
}
- err = usb_submit_urb(urb, GFP_ATOMIC);
+ if (!atomic_read(&ep->chip->shutdown))
+ err = usb_submit_urb(urb, GFP_ATOMIC);
+ else
+ err = -ENODEV;
if (err < 0) {
- usb_audio_err(ep->chip,
- "cannot submit urb %d, error %d: %s\n",
- i, err, usb_error_string(err));
+ if (!atomic_read(&ep->chip->shutdown))
+ usb_audio_err(ep->chip,
+ "cannot submit urb %d, error %d: %s\n",
+ i, err, usb_error_string(err));
goto __error;
}
set_bit(i, &ep->active_mask);
--
2.56.0.506.g506a7eabc5-goog
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2026-11-09 9:03 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-09 9:03 [STABLE v6.1-v5.15] ALSA: usb-audio: Don't try to submit URBs after disconnection Lee Jones
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®