Skip to content

Commit

Permalink
drivers/net: Correct NULL test
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Julia Lawall authored and David S. Miller committed Feb 9, 2010
1 parent 3af26f5 commit bcf4d81
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/net/ax88796.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit bcf4d81

Please sign in to comment.