Skip to content

Commit

Permalink
ASoC: simone: fix resource leak in simone_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 <[email protected]>
Acked-by: Mika Westerberg <[email protected]>
Acked-by: Liam Girdwood <[email protected]>
Signed-off-by: Mark Brown <[email protected]>
  • Loading branch information
AxelLin authored and broonie committed Nov 25, 2010
1 parent c7a734e commit 14abca3
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions sound/soc/ep93xx/simone.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
platform_device_put(simone_snd_device);
goto fail;
}
if (ret)
goto fail3;

return ret;
return 0;

fail:
fail3:
platform_device_put(simone_snd_device);
fail2:
platform_device_del(simone_snd_ac97_device);
fail1:
platform_device_put(simone_snd_ac97_device);
return ret;
}
Expand Down

0 comments on commit 14abca3

Please sign in to comment.