Skip to content

Commit

Permalink
ASoC: smdk_wm9713: fix resource leak in smdk_init error path
Browse files Browse the repository at this point in the history
Fix the error path to properly free allocated resources.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Acked-by: Jassi Brar <jassi.brar@samsung.com>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
  • Loading branch information
Axel Lin authored and Mark Brown committed Nov 25, 2010
1 parent 74bd21e commit b26bb71
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions sound/soc/samsung/smdk_wm9713.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit b26bb71

Please sign in to comment.