ASoC: soc-ac97: Fix error handling in snd_soc_new_ac97_component()

If call to snd_soc_ac97_init_gpio() fails, proper removal procedure
should mirror snd_soc_free_ac97_component() behaviour and call
device_del() before put_device().

Fixes: 9bf5c3d11f ("ASoC: ac97: add gpio chip")
Signed-off-by: Amadeusz Sławiński <amade@asmblr.net>
Link: https://patch.msgid.link/20261014200608.118770-6-amade@asmblr.net
Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
Amadeusz Sławiński 2026-10-14 22:06:05 +02:00 committed by Mark Brown
parent 77dfd98b16
commit fc081cdfc6
No known key found for this signature in database
GPG Key ID: 2FEF73B0B3D03889

View File

@ -241,10 +241,12 @@ struct snd_ac97 *snd_soc_new_ac97_component(struct snd_soc_component *component,
ret = snd_soc_ac97_init_gpio(ac97, component);
if (ret)
goto err_put_device;
goto err_del_device;
return ac97;
err_del_device:
device_del(&ac97->dev);
err_put_device:
put_device(&ac97->dev);
return ERR_PTR(ret);