diff options
author | Julia Lawall <julia@diku.dk> | 2010-10-18 10:11:13 -0400 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2010-10-18 19:29:24 -0400 |
commit | 02ffc5f3f91c265e110ddd1fdd7019a18426ebe5 (patch) | |
tree | 0243071f64cda3a3a11de7c6a93635e69d49b38f /sound/soc | |
parent | f6765502f8daae3d237a394889276c8987f3e299 (diff) |
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/)
// <smpl>
@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;
}
// </smpl>
Signed-off-by: Julia Lawall <julia@diku.dk>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound/soc')
-rw-r--r-- | sound/soc/davinci/davinci-mcasp.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/sound/soc/davinci/davinci-mcasp.c b/sound/soc/davinci/davinci-mcasp.c index c8e97dcbfff4..86918ee12419 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) | |||
898 | res = platform_get_resource(pdev, IORESOURCE_DMA, 0); | 898 | res = platform_get_resource(pdev, IORESOURCE_DMA, 0); |
899 | if (!res) { | 899 | if (!res) { |
900 | dev_err(&pdev->dev, "no DMA resource\n"); | 900 | dev_err(&pdev->dev, "no DMA resource\n"); |
901 | ret = -ENODEV; | ||
901 | goto err_release_region; | 902 | goto err_release_region; |
902 | } | 903 | } |
903 | 904 | ||
@@ -912,6 +913,7 @@ static int davinci_mcasp_probe(struct platform_device *pdev) | |||
912 | res = platform_get_resource(pdev, IORESOURCE_DMA, 1); | 913 | res = platform_get_resource(pdev, IORESOURCE_DMA, 1); |
913 | if (!res) { | 914 | if (!res) { |
914 | dev_err(&pdev->dev, "no DMA resource\n"); | 915 | dev_err(&pdev->dev, "no DMA resource\n"); |
916 | ret = -ENODEV; | ||
915 | goto err_release_region; | 917 | goto err_release_region; |
916 | } | 918 | } |
917 | 919 | ||