Commit 983d7beb7de4ba7c715ea62e982c9fe54fa554a1

Authored by Julia Lawall
Committed by Vinod Koul
1 parent 94d3901c11

drivers/dma/amba-pl08x.c: fix error return code

Convert a 0 error return code to a negative one, as returned elsewhere in the
function.

A simplified version of the semantic match that finds this problem is as
follows: (http://coccinelle.lip6.fr/)

// <smpl>
@@
identifier ret;
expression e,e1,e2,e3,e4,x;
@@

(
if (\(ret != 0\|ret < 0\) || ...) { ... return ...; }
|
ret = 0
)
... when != ret = e1
*x = \(kmalloc\|kzalloc\|kcalloc\|devm_kzalloc\|ioremap\|ioremap_nocache\|devm_ioremap\|devm_ioremap_nocache\)(...);
... when != x = e2
    when != ret = e3
*if (x == NULL || ...)
{
  ... when != ret = e4
*  return ret;
}
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Vinod Koul <vinod.koul@linux.intel.com>

Showing 1 changed file with 2 additions and 0 deletions Side-by-side Diff

drivers/dma/amba-pl08x.c
... ... @@ -1892,6 +1892,7 @@
1892 1892 pl08x->pd = dev_get_platdata(&adev->dev);
1893 1893 if (!pl08x->pd) {
1894 1894 dev_err(&adev->dev, "no platform data supplied\n");
  1895 + ret = -EINVAL;
1895 1896 goto out_no_platdata;
1896 1897 }
1897 1898  
... ... @@ -1943,6 +1944,7 @@
1943 1944 dev_err(&adev->dev, "%s failed to allocate "
1944 1945 "physical channel holders\n",
1945 1946 __func__);
  1947 + ret = -ENOMEM;
1946 1948 goto out_no_phychans;
1947 1949 }
1948 1950