Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[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 <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>

authored by

Takashi Iwai and committed by
Jaroslav Kysela
2a2a5ddd 7fbe3ca5

+1 -1
+1 -1
sound/usb/usbaudio.c
··· 3286 3286 3287 3287 static int snd_usb_audio_free(struct snd_usb_audio *chip) 3288 3288 { 3289 + usb_chip[chip->index] = NULL; 3289 3290 kfree(chip); 3290 3291 return 0; 3291 3292 } ··· 3548 3547 list_for_each(p, &chip->mixer_list) { 3549 3548 snd_usb_mixer_disconnect(p); 3550 3549 } 3551 - usb_chip[chip->index] = NULL; 3552 3550 mutex_unlock(&register_mutex); 3553 3551 snd_card_free_when_closed(card); 3554 3552 } else {