diff options
author | Axel Lin <axel.lin@gmail.com> | 2010-11-25 02:13:09 -0500 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2010-11-25 06:09:50 -0500 |
commit | ac8f924af555573e29b126ac5cef4fdd122ae517 (patch) | |
tree | 0861be93839ee3f84bde6ee349daa63413dd4f32 /sound/soc/imx/imx-ssi.c | |
parent | 14abca3dfc51c0a4f798183f131d63bfd6552bd4 (diff) |
ASoC: imx-ssi: fix resource leak
Fix imx_ssi_probe() error path and imx_ssi_remove() to properly free
allocated resources.
Signed-off-by: Axel Lin <axel.lin@gmail.com>
Acked-by: Sascha Hauer <s.hauer@pengutronix.de>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound/soc/imx/imx-ssi.c')
-rw-r--r-- | sound/soc/imx/imx-ssi.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/sound/soc/imx/imx-ssi.c b/sound/soc/imx/imx-ssi.c index d2d98c75ee8a..390b6ffc2658 100644 --- a/sound/soc/imx/imx-ssi.c +++ b/sound/soc/imx/imx-ssi.c | |||
@@ -679,8 +679,11 @@ static int imx_ssi_probe(struct platform_device *pdev) | |||
679 | } | 679 | } |
680 | 680 | ||
681 | ssi->soc_platform_pdev_fiq = platform_device_alloc("imx-fiq-pcm-audio", pdev->id); | 681 | ssi->soc_platform_pdev_fiq = platform_device_alloc("imx-fiq-pcm-audio", pdev->id); |
682 | if (!ssi->soc_platform_pdev_fiq) | 682 | if (!ssi->soc_platform_pdev_fiq) { |
683 | ret = -ENOMEM; | ||
683 | goto failed_pdev_fiq_alloc; | 684 | goto failed_pdev_fiq_alloc; |
685 | } | ||
686 | |||
684 | platform_set_drvdata(ssi->soc_platform_pdev_fiq, ssi); | 687 | platform_set_drvdata(ssi->soc_platform_pdev_fiq, ssi); |
685 | ret = platform_device_add(ssi->soc_platform_pdev_fiq); | 688 | ret = platform_device_add(ssi->soc_platform_pdev_fiq); |
686 | if (ret) { | 689 | if (ret) { |
@@ -689,8 +692,11 @@ static int imx_ssi_probe(struct platform_device *pdev) | |||
689 | } | 692 | } |
690 | 693 | ||
691 | ssi->soc_platform_pdev = platform_device_alloc("imx-pcm-audio", pdev->id); | 694 | ssi->soc_platform_pdev = platform_device_alloc("imx-pcm-audio", pdev->id); |
692 | if (!ssi->soc_platform_pdev) | 695 | if (!ssi->soc_platform_pdev) { |
696 | ret = -ENOMEM; | ||
693 | goto failed_pdev_alloc; | 697 | goto failed_pdev_alloc; |
698 | } | ||
699 | |||
694 | platform_set_drvdata(ssi->soc_platform_pdev, ssi); | 700 | platform_set_drvdata(ssi->soc_platform_pdev, ssi); |
695 | ret = platform_device_add(ssi->soc_platform_pdev); | 701 | ret = platform_device_add(ssi->soc_platform_pdev); |
696 | if (ret) { | 702 | if (ret) { |
@@ -703,6 +709,7 @@ static int imx_ssi_probe(struct platform_device *pdev) | |||
703 | failed_pdev_add: | 709 | failed_pdev_add: |
704 | platform_device_put(ssi->soc_platform_pdev); | 710 | platform_device_put(ssi->soc_platform_pdev); |
705 | failed_pdev_alloc: | 711 | failed_pdev_alloc: |
712 | platform_device_del(ssi->soc_platform_pdev_fiq); | ||
706 | failed_pdev_fiq_add: | 713 | failed_pdev_fiq_add: |
707 | platform_device_put(ssi->soc_platform_pdev_fiq); | 714 | platform_device_put(ssi->soc_platform_pdev_fiq); |
708 | failed_pdev_fiq_alloc: | 715 | failed_pdev_fiq_alloc: |
@@ -726,8 +733,8 @@ static int __devexit imx_ssi_remove(struct platform_device *pdev) | |||
726 | struct resource *res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 733 | struct resource *res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
727 | struct imx_ssi *ssi = platform_get_drvdata(pdev); | 734 | struct imx_ssi *ssi = platform_get_drvdata(pdev); |
728 | 735 | ||
729 | platform_device_del(ssi->soc_platform_pdev); | 736 | platform_device_unregister(ssi->soc_platform_pdev); |
730 | platform_device_put(ssi->soc_platform_pdev); | 737 | platform_device_unregister(ssi->soc_platform_pdev_fiq); |
731 | 738 | ||
732 | snd_soc_unregister_dai(&pdev->dev); | 739 | snd_soc_unregister_dai(&pdev->dev); |
733 | 740 | ||