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

ALSA: ac97: Fix double free of ac97_codec_device

put_device will call ac97_codec_release to free
ac97_codec_device and other resources, so remove the kfree
and other redundant code.

Fixes: 74426fbff66e ("ALSA: ac97: add an ac97 bus")
Signed-off-by: Ding Xiang <dingxiang@cmss.chinamobile.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>

authored by

Ding Xiang and committed by
Takashi Iwai
607975b3 3b817994

+4 -9
+4 -9
sound/ac97/bus.c
··· 122 122 vendor_id); 123 123 124 124 ret = device_add(&codec->dev); 125 - if (ret) 126 - goto err_free_codec; 125 + if (ret) { 126 + put_device(&codec->dev); 127 + return ret; 128 + } 127 129 128 130 return 0; 129 - err_free_codec: 130 - of_node_put(codec->dev.of_node); 131 - put_device(&codec->dev); 132 - kfree(codec); 133 - ac97_ctrl->codecs[idx] = NULL; 134 - 135 - return ret; 136 131 } 137 132 138 133 unsigned int snd_ac97_bus_scan_one(struct ac97_controller *adrv,