summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJulia Lawall <julia@diku.dk>2010-10-18 04:11:14 +0000
committerDavid S. Miller <davem@davemloft.net>2010-10-21 04:25:50 -0700
commit13eea19213c1f4b711124ddc08c4bb9344442b64 (patch)
tree83032b178c6cc9a4c7a40f87be6b3da1decd6bb1
parentafed4ccb0d975f1d3c98880ecf19a24f3d842394 (diff)
downloadlinux-stable-13eea19213c1f4b711124ddc08c4bb9344442b64.tar.gz
linux-stable-13eea19213c1f4b711124ddc08c4bb9344442b64.tar.bz2
linux-stable-13eea19213c1f4b711124ddc08c4bb9344442b64.zip
drivers/net/ax88796.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> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/ax88796.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/net/ax88796.c b/drivers/net/ax88796.c
index 20e946b1e744..b6da4cf3694b 100644
--- a/drivers/net/ax88796.c
+++ b/drivers/net/ax88796.c
@@ -864,6 +864,7 @@ static int ax_probe(struct platform_device *pdev)
res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
if (res == NULL) {
dev_err(&pdev->dev, "no IRQ specified\n");
+ ret = -ENXIO;
goto exit_mem;
}