ASoC: simone: fix resource leak in simone_init error path

Fix the error path to properly free allocated resources.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Acked-by: Mika Westerberg <mika.westerberg@iki.fi>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
This commit is contained in:
Axel Lin 2010-11-25 15:12:30 +08:00 committed by Mark Brown
parent c7a734e58e
commit 14abca3dfc

View file

@ -54,24 +54,26 @@ static int __init simone_init(void)
ret = platform_device_add(simone_snd_ac97_device);
if (ret)
goto fail;
goto fail1;
simone_snd_device = platform_device_alloc("soc-audio", -1);
if (!simone_snd_device) {
ret = -ENOMEM;
goto fail;
goto fail2;
}
platform_set_drvdata(simone_snd_device, &snd_soc_simone);
ret = platform_device_add(simone_snd_device);
if (ret) {
if (ret)
goto fail3;
return 0;
fail3:
platform_device_put(simone_snd_device);
goto fail;
}
return ret;
fail:
fail2:
platform_device_del(simone_snd_ac97_device);
fail1:
platform_device_put(simone_snd_ac97_device);
return ret;
}