Skip to content

Commit

Permalink
drivers/atm: Correct redundant test
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
Julia Lawall authored and davem330 committed Jul 27, 2009
1 parent a44a4a0 commit 6cf5767
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/atm/solos-pci.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 6cf5767

Please sign in to comment.