drivers/net: Correct NULL test

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Linux Kernel Mailing List
Date: Wednesday, February 10, 2010 - 8:59 am

Gitweb:     http://git.kernel.org/linus/bcf4d812e66ee95f762b38063d654fd1ff7156b0
Commit:     bcf4d812e66ee95f762b38063d654fd1ff7156b0
Parent:     3af26f58d1920d904da87c3897d23070fe2266b4
Author:     Julia Lawall <julia@diku.dk>
AuthorDate: Mon Feb 8 22:44:18 2010 -0800
Committer:  David S. Miller <davem@davemloft.net>
CommitDate: Mon Feb 8 22:44:18 2010 -0800

    drivers/net: Correct NULL test
    
    Test the value that was just allocated rather than the previously tested one.
    
    A simplified version of the semantic match that finds this problem is as
    follows: (http://coccinelle.lip6.fr/)
    
    // <smpl>
    @r@
    expression *x;
    expression e;
    identifier l;
    @@
    
    if (x == NULL || ...) {
        ... when forall
        return ...; }
    ... when != goto l;
        when != x = e
        when != &x
    *x == NULL
    // </smpl>
    
    Signed-off-by: Julia Lawall <julia@diku.dk>
    Signed-off-by: David S. Miller <davem@davemloft.net>
---
 drivers/net/ax88796.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/net/ax88796.c b/drivers/net/ax88796.c
index 62d9c9c..1dd4403 100644
--- a/drivers/net/ax88796.c
+++ b/drivers/net/ax88796.c
@@ -921,7 +921,7 @@ static int ax_probe(struct platform_device *pdev)
  		size = (res->end - res->start) + 1;
 
 		ax->mem2 = request_mem_region(res->start, size, pdev->name);
-		if (ax->mem == NULL) {
+		if (ax->mem2 == NULL) {
 			dev_err(&pdev->dev, "cannot reserve registers\n");
 			ret = -ENXIO;
 			goto exit_mem1;
--
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
drivers/net: Correct NULL test, Linux Kernel Mailing ..., (Wed Feb 10, 8:59 am)