From: Axel Lin Date: Thu, 25 Nov 2010 07:11:45 +0000 (+0800) Subject: ASoC: smdk_wm9713: fix resource leak in smdk_init error path X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=b26bb71f610f9b346203bff407e4278d98f9fe80;p=GitHub%2FLineageOS%2Fandroid_kernel_samsung_universal7580.git ASoC: smdk_wm9713: fix resource leak in smdk_init error path Fix the error path to properly free allocated resources. Signed-off-by: Axel Lin Acked-by: Jassi Brar Acked-by: Liam Girdwood Signed-off-by: Mark Brown --- diff --git a/sound/soc/samsung/smdk_wm9713.c b/sound/soc/samsung/smdk_wm9713.c index 7ce243086e7..238cb3a38c5 100644 --- a/sound/soc/samsung/smdk_wm9713.c +++ b/sound/soc/samsung/smdk_wm9713.c @@ -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; }