Re: [PATCH 2/5] drivers/dma/amba-pl08x.c: fix error return code

2012-08-21 Thread Vinod Koul
On Tue, 2012-08-14 at 14:58 +0200, Julia Lawall wrote:
> From: Julia Lawall 
> 
> Convert a 0 error return code to a negative one, as returned elsewhere in the
> function.
Applied, thanks

-- 
~Vinod

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 2/5] drivers/dma/amba-pl08x.c: fix error return code

2012-08-21 Thread Vinod Koul
On Tue, 2012-08-14 at 14:58 +0200, Julia Lawall wrote:
 From: Julia Lawall julia.law...@lip6.fr
 
 Convert a 0 error return code to a negative one, as returned elsewhere in the
 function.
Applied, thanks

-- 
~Vinod

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 2/5] drivers/dma/amba-pl08x.c: fix error return code

2012-08-14 Thread Julia Lawall
From: Julia Lawall 

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/)

// 
@@
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;
}
// 

Signed-off-by: Julia Lawall 

---
 drivers/dma/amba-pl08x.c |2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/dma/amba-pl08x.c b/drivers/dma/amba-pl08x.c
index 6fbeebb..d1cc579 100644
--- a/drivers/dma/amba-pl08x.c
+++ b/drivers/dma/amba-pl08x.c
@@ -1892,6 +1892,7 @@ static int pl08x_probe(struct amba_device *adev, const 
struct amba_id *id)
pl08x->pd = dev_get_platdata(>dev);
if (!pl08x->pd) {
dev_err(>dev, "no platform data supplied\n");
+   ret = -EINVAL;
goto out_no_platdata;
}
 
@@ -1943,6 +1944,7 @@ static int pl08x_probe(struct amba_device *adev, const 
struct amba_id *id)
dev_err(>dev, "%s failed to allocate "
"physical channel holders\n",
__func__);
+   ret = -ENOMEM;
goto out_no_phychans;
}
 

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 2/5] drivers/dma/amba-pl08x.c: fix error return code

2012-08-14 Thread Julia Lawall
From: Julia Lawall julia.law...@lip6.fr

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.law...@lip6.fr

---
 drivers/dma/amba-pl08x.c |2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/dma/amba-pl08x.c b/drivers/dma/amba-pl08x.c
index 6fbeebb..d1cc579 100644
--- a/drivers/dma/amba-pl08x.c
+++ b/drivers/dma/amba-pl08x.c
@@ -1892,6 +1892,7 @@ static int pl08x_probe(struct amba_device *adev, const 
struct amba_id *id)
pl08x-pd = dev_get_platdata(adev-dev);
if (!pl08x-pd) {
dev_err(adev-dev, no platform data supplied\n);
+   ret = -EINVAL;
goto out_no_platdata;
}
 
@@ -1943,6 +1944,7 @@ static int pl08x_probe(struct amba_device *adev, const 
struct amba_id *id)
dev_err(adev-dev, %s failed to allocate 
physical channel holders\n,
__func__);
+   ret = -ENOMEM;
goto out_no_phychans;
}
 

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/