drivers/atm: Correct redundant test
authorJulia Lawall <julia@diku.dk>
Mon, 27 Jul 2009 18:38:52 +0000 (11:38 -0700)
committerDavid S. Miller <davem@davemloft.net>
Mon, 27 Jul 2009 18:38:52 +0000 (11:38 -0700)
str has already been tested.  It seems that this test should be on the
recently returned value snr.

A simplified version of the semantic match that finds this problem is as
follows: (http://www.emn.fr/x-info/coccinelle/)

// <smpl>
@r exists@
local idexpression x;
expression E;
@@

if (x == NULL || ...) { ... when forall
   return ...; }
... when != \(x=E\|x--\|x++\|--x\|++x\|x-=E\|x+=E\|x|=E\|x&=E\|&x\)
(
*x == NULL
|
*x != NULL
)
// </smpl>

Signed-off-by: Julia Lawall <julia@diku.dk>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/atm/solos-pci.c

index 9359613..307321b 100644 (file)
@@ -372,7 +372,7 @@ static int process_status(struct solos_card *card, int port, struct sk_buff *skb
        }
 
        snr = next_string(skb);
-       if (!str)
+       if (!snr)
                return -EIO;
        attn = next_string(skb);
        if (!attn)