From: Takashi Iwai Date: Mon, 8 Jan 2007 16:42:22 +0000 (+0100) Subject: [ALSA] usbaudio - Fix kobject_add() error at reconnection X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=2a2a5dddece676acbe3775e5ca9961f325717022;p=GitHub%2Fexynos8895%2Fandroid_kernel_samsung_universal8895.git [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: Takashi Iwai Signed-off-by: Jaroslav Kysela --- diff --git a/sound/usb/usbaudio.c b/sound/usb/usbaudio.c index 5f160eebd15c..19bdcc74c96c 100644 --- a/sound/usb/usbaudio.c +++ b/sound/usb/usbaudio.c @@ -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) { + usb_chip[chip->index] = NULL; kfree(chip); return 0; } @@ -3547,7 +3548,6 @@ static void snd_usb_audio_disconnect(struct usb_device *dev, void *ptr) list_for_each(p, &chip->mixer_list) { snd_usb_mixer_disconnect(p); } - usb_chip[chip->index] = NULL; mutex_unlock(®ister_mutex); snd_card_free_when_closed(card); } else {