From: Julia Lawall Date: Mon, 18 Oct 2010 14:11:13 +0000 (+0200) Subject: ASoC: davinci-mcasp.c: Return error code in failure X-Git-Tag: v2.6.37-rc1~82^2~8^2~6 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=02ffc5f3f91c265e110ddd1fdd7019a18426ebe5;p=platform%2Fkernel%2Flinux-exynos.git ASoC: davinci-mcasp.c: Return error code in failure In this code, 0 is returned on failure, even though other failures return -ENOMEM or other similar values. A simplified version of the semantic match that finds this problem is as follows: (http://coccinelle.lip6.fr/) // @a@ identifier alloc; identifier ret; constant C; expression x; @@ x = alloc(...); if (x == NULL) { <+... \(ret = -C; \| return -C; \) ...+> } @@ identifier f, a.alloc; expression ret; expression x,e1,e2,e3; @@ ret = 0 ... when != ret = e1 *x = alloc(...) ... when != ret = e2 if (x == NULL) { ... when != ret = e3 return ret; } // Signed-off-by: Julia Lawall Acked-by: Liam Girdwood Signed-off-by: Mark Brown --- diff --git a/sound/soc/davinci/davinci-mcasp.c b/sound/soc/davinci/davinci-mcasp.c index c8e97dc..86918ee 100644 --- a/sound/soc/davinci/davinci-mcasp.c +++ b/sound/soc/davinci/davinci-mcasp.c @@ -898,6 +898,7 @@ static int davinci_mcasp_probe(struct platform_device *pdev) res = platform_get_resource(pdev, IORESOURCE_DMA, 0); if (!res) { dev_err(&pdev->dev, "no DMA resource\n"); + ret = -ENODEV; goto err_release_region; } @@ -912,6 +913,7 @@ static int davinci_mcasp_probe(struct platform_device *pdev) res = platform_get_resource(pdev, IORESOURCE_DMA, 1); if (!res) { dev_err(&pdev->dev, "no DMA resource\n"); + ret = -ENODEV; goto err_release_region; }