diff mbox

[2/7] ALSA: line6: Abort if inconsistent usbdev is found at disconnect

Message ID 1421744662-6497-3-git-send-email-tiwai@suse.de (mailing list archive)
State Accepted
Commit 2a324fcdb568f4d7b0b65b271039beb987f6e1cd
Headers show

Commit Message

Takashi Iwai Jan. 20, 2015, 9:04 a.m. UTC
It's utterly unsafe to proceed further the disconnect procedure if the
assigned usbdev is inconsistent with the expected object.  Better to
put a WARN_ON() for more cautions and abort immediately.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
 sound/usb/line6/driver.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
diff mbox

Patch

diff --git a/sound/usb/line6/driver.c b/sound/usb/line6/driver.c
index e8d51381ffdb..625272fe227a 100644
--- a/sound/usb/line6/driver.c
+++ b/sound/usb/line6/driver.c
@@ -585,12 +585,12 @@  void line6_disconnect(struct usb_interface *interface)
 	if (!line6)
 		return;
 
+	if (WARN_ON(usbdev != line6->usbdev))
+		return;
+
 	if (line6->urb_listen != NULL)
 		line6_stop_listen(line6);
 
-	if (usbdev != line6->usbdev)
-		dev_err(line6->ifcdev, "driver bug: inconsistent usb device\n");
-
 	snd_card_disconnect(line6->card);
 	if (line6->line6pcm)
 		line6_pcm_disconnect(line6->line6pcm);