ALSA: ac97: fix possible memory leak in snd_ac97_dev_register()
authorYang Yingliang <yangyingliang@huawei.com>
Wed, 19 Oct 2022 09:30:25 +0000 (17:30 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 3 Nov 2022 14:59:15 +0000 (23:59 +0900)
commit4fdf6f978c6b605ca0d67bf0e982b7a8fc0f4aab
treedd0cd1e6700c9c48b8d3f303f49599af6ad3f1a1
parentb68873690373cf8f687fa366bd3af977cb4802b5
ALSA: ac97: fix possible memory leak in snd_ac97_dev_register()

[ Upstream commit 4881bda5ea05c8c240fc8afeaa928e2bc43f61fa ]

If device_register() fails in snd_ac97_dev_register(), it should
call put_device() to give up reference, or the name allocated in
dev_set_name() is leaked.

Fixes: 0ca06a00e206 ("[ALSA] AC97 bus interface for ad-hoc drivers")
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
Link: https://lore.kernel.org/r/20221019093025.1179475-1-yangyingliang@huawei.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
sound/pci/ac97/ac97_codec.c