[PATCH] ALSA: usb-audio: Check shutdown at endpoint_set_interface()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



The call of usb_set_interface() and a delay are superfluous when the
device has been already disconnected.  Add a disconnection check
before doing it.

Signed-off-by: Takashi Iwai <tiwai@xxxxxxx>
---
 sound/usb/endpoint.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/sound/usb/endpoint.c b/sound/usb/endpoint.c
index 8f65349a06d3..568099467dbb 100644
--- a/sound/usb/endpoint.c
+++ b/sound/usb/endpoint.c
@@ -921,6 +921,9 @@ static int endpoint_set_interface(struct snd_usb_audio *chip,
 
 	if (ep->iface_ref->altset == altset)
 		return 0;
+	/* already disconnected? */
+	if (unlikely(atomic_read(&chip->shutdown)))
+		return -ENODEV;
 
 	usb_audio_dbg(chip, "Setting usb interface %d:%d for EP 0x%x\n",
 		      ep->iface, altset, ep->ep_num);
-- 
2.43.0





[Index of Archives]     [Pulseaudio]     [Linux Audio Users]     [ALSA Devel]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]

  Powered by Linux