Commit 2a2a5ddd authored by Takashi Iwai's avatar Takashi Iwai Committed by Jaroslav Kysela

[ALSA] usbaudio - Fix kobject_add() error at reconnection

Fixed the error from kobject_add() at reconnection the usb audio device.
This happens when an app keeps opening a device while the device is
replugged, due to the confliction of the internal bookkept index and
the really empty slot.
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
Signed-off-by: default avatarJaroslav Kysela <perex@suse.cz>
parent 7fbe3ca5
...@@ -3286,6 +3286,7 @@ static void snd_usb_audio_create_proc(struct snd_usb_audio *chip) ...@@ -3286,6 +3286,7 @@ static void snd_usb_audio_create_proc(struct snd_usb_audio *chip)
static int snd_usb_audio_free(struct snd_usb_audio *chip) static int snd_usb_audio_free(struct snd_usb_audio *chip)
{ {
usb_chip[chip->index] = NULL;
kfree(chip); kfree(chip);
return 0; return 0;
} }
...@@ -3547,7 +3548,6 @@ static void snd_usb_audio_disconnect(struct usb_device *dev, void *ptr) ...@@ -3547,7 +3548,6 @@ static void snd_usb_audio_disconnect(struct usb_device *dev, void *ptr)
list_for_each(p, &chip->mixer_list) { list_for_each(p, &chip->mixer_list) {
snd_usb_mixer_disconnect(p); snd_usb_mixer_disconnect(p);
} }
usb_chip[chip->index] = NULL;
mutex_unlock(&register_mutex); mutex_unlock(&register_mutex);
snd_card_free_when_closed(card); snd_card_free_when_closed(card);
} else { } else {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment