提交 ac8f924a 编写于 作者: A Axel Lin 提交者: Mark Brown

ASoC: imx-ssi: fix resource leak

Fix imx_ssi_probe() error path and imx_ssi_remove() to properly free
allocated resources.
Signed-off-by: NAxel Lin <axel.lin@gmail.com>
Acked-by: NSascha Hauer <s.hauer@pengutronix.de>
Acked-by: NLiam Girdwood <lrg@slimlogic.co.uk>
Signed-off-by: NMark Brown <broonie@opensource.wolfsonmicro.com>
上级 14abca3d
...@@ -679,8 +679,11 @@ static int imx_ssi_probe(struct platform_device *pdev) ...@@ -679,8 +679,11 @@ static int imx_ssi_probe(struct platform_device *pdev)
} }
ssi->soc_platform_pdev_fiq = platform_device_alloc("imx-fiq-pcm-audio", pdev->id); ssi->soc_platform_pdev_fiq = platform_device_alloc("imx-fiq-pcm-audio", pdev->id);
if (!ssi->soc_platform_pdev_fiq) if (!ssi->soc_platform_pdev_fiq) {
ret = -ENOMEM;
goto failed_pdev_fiq_alloc; goto failed_pdev_fiq_alloc;
}
platform_set_drvdata(ssi->soc_platform_pdev_fiq, ssi); platform_set_drvdata(ssi->soc_platform_pdev_fiq, ssi);
ret = platform_device_add(ssi->soc_platform_pdev_fiq); ret = platform_device_add(ssi->soc_platform_pdev_fiq);
if (ret) { if (ret) {
...@@ -689,8 +692,11 @@ static int imx_ssi_probe(struct platform_device *pdev) ...@@ -689,8 +692,11 @@ static int imx_ssi_probe(struct platform_device *pdev)
} }
ssi->soc_platform_pdev = platform_device_alloc("imx-pcm-audio", pdev->id); ssi->soc_platform_pdev = platform_device_alloc("imx-pcm-audio", pdev->id);
if (!ssi->soc_platform_pdev) if (!ssi->soc_platform_pdev) {
ret = -ENOMEM;
goto failed_pdev_alloc; goto failed_pdev_alloc;
}
platform_set_drvdata(ssi->soc_platform_pdev, ssi); platform_set_drvdata(ssi->soc_platform_pdev, ssi);
ret = platform_device_add(ssi->soc_platform_pdev); ret = platform_device_add(ssi->soc_platform_pdev);
if (ret) { if (ret) {
...@@ -703,6 +709,7 @@ static int imx_ssi_probe(struct platform_device *pdev) ...@@ -703,6 +709,7 @@ static int imx_ssi_probe(struct platform_device *pdev)
failed_pdev_add: failed_pdev_add:
platform_device_put(ssi->soc_platform_pdev); platform_device_put(ssi->soc_platform_pdev);
failed_pdev_alloc: failed_pdev_alloc:
platform_device_del(ssi->soc_platform_pdev_fiq);
failed_pdev_fiq_add: failed_pdev_fiq_add:
platform_device_put(ssi->soc_platform_pdev_fiq); platform_device_put(ssi->soc_platform_pdev_fiq);
failed_pdev_fiq_alloc: failed_pdev_fiq_alloc:
...@@ -726,8 +733,8 @@ static int __devexit imx_ssi_remove(struct platform_device *pdev) ...@@ -726,8 +733,8 @@ static int __devexit imx_ssi_remove(struct platform_device *pdev)
struct resource *res = platform_get_resource(pdev, IORESOURCE_MEM, 0); struct resource *res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
struct imx_ssi *ssi = platform_get_drvdata(pdev); struct imx_ssi *ssi = platform_get_drvdata(pdev);
platform_device_del(ssi->soc_platform_pdev); platform_device_unregister(ssi->soc_platform_pdev);
platform_device_put(ssi->soc_platform_pdev); platform_device_unregister(ssi->soc_platform_pdev_fiq);
snd_soc_unregister_dai(&pdev->dev); snd_soc_unregister_dai(&pdev->dev);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册