aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/samsung
diff options
context:
space:
mode:
authorAxel Lin <axel.lin@gmail.com>2010-11-26 01:52:47 -0500
committerMark Brown <broonie@opensource.wolfsonmicro.com>2010-11-29 06:00:55 -0500
commitb6a11f497369fff39e8eb91c83b531d41a73986d (patch)
treebfa32d7b2a6f48fc7f9098184776f8b93c4bb88f /sound/soc/samsung
parent853dc30274878d14b7abef8313c801f5559b4c47 (diff)
ASoC: Fix resource leak in neo1973_gta02_init() error path
Properly free allocated resources in neo1973_gta02_init() error path. 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>
Diffstat (limited to 'sound/soc/samsung')
-rw-r--r--sound/soc/samsung/neo1973_gta02_wm8753.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/sound/soc/samsung/neo1973_gta02_wm8753.c b/sound/soc/samsung/neo1973_gta02_wm8753.c
index 8c65b6334f51..3eec610c10f9 100644
--- a/sound/soc/samsung/neo1973_gta02_wm8753.c
+++ b/sound/soc/samsung/neo1973_gta02_wm8753.c
@@ -439,24 +439,20 @@ static int __init neo1973_gta02_init(void)
439 439
440 /* register bluetooth DAI here */ 440 /* register bluetooth DAI here */
441 ret = snd_soc_register_dai(&neo1973_gta02_snd_device->dev, &bt_dai); 441 ret = snd_soc_register_dai(&neo1973_gta02_snd_device->dev, &bt_dai);
442 if (ret) { 442 if (ret)
443 platform_device_put(neo1973_gta02_snd_device); 443 goto err_put_device;
444 return ret;
445 }
446 444
447 platform_set_drvdata(neo1973_gta02_snd_device, &neo1973_gta02); 445 platform_set_drvdata(neo1973_gta02_snd_device, &neo1973_gta02);
448 ret = platform_device_add(neo1973_gta02_snd_device); 446 ret = platform_device_add(neo1973_gta02_snd_device);
449 447
450 if (ret) { 448 if (ret)
451 platform_device_put(neo1973_gta02_snd_device); 449 goto err_unregister_dai;
452 return ret;
453 }
454 450
455 /* Initialise GPIOs used by amp */ 451 /* Initialise GPIOs used by amp */
456 ret = gpio_request(GTA02_GPIO_HP_IN, "GTA02_HP_IN"); 452 ret = gpio_request(GTA02_GPIO_HP_IN, "GTA02_HP_IN");
457 if (ret) { 453 if (ret) {
458 pr_err("gta02_wm8753: Failed to register GPIO %d\n", GTA02_GPIO_HP_IN); 454 pr_err("gta02_wm8753: Failed to register GPIO %d\n", GTA02_GPIO_HP_IN);
459 goto err_unregister_device; 455 goto err_del_device;
460 } 456 }
461 457
462 ret = gpio_direction_output(GTA02_GPIO_HP_IN, 1); 458 ret = gpio_direction_output(GTA02_GPIO_HP_IN, 1);
@@ -483,8 +479,12 @@ err_free_gpio_amp_shut:
483 gpio_free(GTA02_GPIO_AMP_SHUT); 479 gpio_free(GTA02_GPIO_AMP_SHUT);
484err_free_gpio_hp_in: 480err_free_gpio_hp_in:
485 gpio_free(GTA02_GPIO_HP_IN); 481 gpio_free(GTA02_GPIO_HP_IN);
486err_unregister_device: 482err_del_device:
487 platform_device_unregister(neo1973_gta02_snd_device); 483 platform_device_del(neo1973_gta02_snd_device);
484err_unregister_dai:
485 snd_soc_unregister_dai(&neo1973_gta02_snd_device->dev);
486err_put_device:
487 platform_device_put(neo1973_gta02_snd_device);
488 return ret; 488 return ret;
489} 489}
490module_init(neo1973_gta02_init); 490module_init(neo1973_gta02_init);