From: Takashi Iwai <tiwai@suse.de>
Date: Mon, 28 Oct 2013 10:24:23 +0000 (+0100)
Subject: ALSA: 6fire: Fix probe of multiple cards
X-Git-Tag: firefly_0821_release~6453^2~283
X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=75dab4710ba28b127cd5587b44ea5668fcde9a61;p=firefly-linux-kernel-4.4.55.git

ALSA: 6fire: Fix probe of multiple cards

commit 9b389a8a022110b4bc055a19b888283544d9eba6 upstream.

The probe code of snd-usb-6fire driver overrides the devices[] pointer
wrongly without checking whether it's already occupied or not.  This
would screw up the device disconnection later.

Spotted by coverity CID 141423.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---

diff --git a/sound/usb/6fire/chip.c b/sound/usb/6fire/chip.c
index 4394ae796356..0716ba691398 100644
--- a/sound/usb/6fire/chip.c
+++ b/sound/usb/6fire/chip.c
@@ -101,7 +101,7 @@ static int usb6fire_chip_probe(struct usb_interface *intf,
 			usb_set_intfdata(intf, chips[i]);
 			mutex_unlock(&register_mutex);
 			return 0;
-		} else if (regidx < 0)
+		} else if (!devices[i] && regidx < 0)
 			regidx = i;
 	}
 	if (regidx < 0) {