Commit b26bb71f authored by Axel Lin's avatar Axel Lin Committed by Mark Brown

ASoC: smdk_wm9713: fix resource leak in smdk_init error path

Fix the error path to properly free allocated resources.
Signed-off-by: default avatarAxel Lin <axel.lin@gmail.com>
Acked-by: default avatarJassi Brar <jassi.brar@samsung.com>
Acked-by: default avatarLiam Girdwood <lrg@slimlogic.co.uk>
Signed-off-by: default avatarMark Brown <broonie@opensource.wolfsonmicro.com>
parent 74bd21e9
......@@ -70,24 +70,27 @@ static int __init smdk_init(void)
ret = platform_device_add(smdk_snd_wm9713_device);
if (ret)
goto err;
goto err1;
smdk_snd_ac97_device = platform_device_alloc("soc-audio", -1);
if (!smdk_snd_ac97_device) {
ret = -ENOMEM;
goto err;
goto err2;
}
platform_set_drvdata(smdk_snd_ac97_device, &smdk);
ret = platform_device_add(smdk_snd_ac97_device);
if (ret) {
platform_device_put(smdk_snd_ac97_device);
goto err;
}
if (ret)
goto err3;
return 0;
err:
err3:
platform_device_put(smdk_snd_ac97_device);
err2:
platform_device_del(smdk_snd_wm9713_device);
err1:
platform_device_put(smdk_snd_wm9713_device);
return ret;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment