netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 6/6] drivers/atm/iphase.c: fix error return code
       [not found] <1344160356-387-1-git-send-email-Julia.Lawall@lip6.fr>
@ 2012-08-05  9:52 ` Julia Lawall
  2012-08-06 20:30   ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Julia Lawall @ 2012-08-05  9:52 UTC (permalink / raw)
  To: Chas Williams
  Cc: kernel-janitors, linux-atm-general, netdev, linux-kernel,
	Julia Lawall

From: Julia Lawall <julia@diku.dk>

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@diku.dk>

---
 drivers/atm/iphase.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/atm/iphase.c b/drivers/atm/iphase.c
index d438601..96cce6d 100644
--- a/drivers/atm/iphase.c
+++ b/drivers/atm/iphase.c
@@ -2362,7 +2362,7 @@ static int __devinit ia_init(struct atm_dev *dev)
 	{  
 		printk(DEV_LABEL " (itf %d): can't set up page mapping\n",  
 			    dev->number);  
-		return error;  
+		return -ENOMEM;
 	}  
 	IF_INIT(printk(DEV_LABEL " (itf %d): rev.%d,base=%p,irq=%d\n",  
 			dev->number, iadev->pci->revision, base, iadev->irq);)

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH 6/6] drivers/atm/iphase.c: fix error return code
  2012-08-05  9:52 ` [PATCH 6/6] drivers/atm/iphase.c: fix error return code Julia Lawall
@ 2012-08-06 20:30   ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2012-08-06 20:30 UTC (permalink / raw)
  To: Julia.Lawall
  Cc: chas, kernel-janitors, linux-atm-general, netdev, linux-kernel,
	julia

From: Julia Lawall <Julia.Lawall@lip6.fr>
Date: Sun,  5 Aug 2012 11:52:36 +0200

> From: Julia Lawall <julia@diku.dk>
> 
> 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/)
 ...
> Signed-off-by: Julia Lawall <julia@diku.dk>

Applied.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-08-06 20:30 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <1344160356-387-1-git-send-email-Julia.Lawall@lip6.fr>
2012-08-05  9:52 ` [PATCH 6/6] drivers/atm/iphase.c: fix error return code Julia Lawall
2012-08-06 20:30   ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).