Skip to content

Commit

Permalink
drivers/net: Correct redundant test
Browse files Browse the repository at this point in the history
res has already been tested.  It seems that this test should be on the
recently returned value mmio.

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>
  • Loading branch information
Julia Lawall authored and David S. Miller committed Jul 27, 2009
1 parent f004ec7 commit 463889e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/net/ethoc.c
Original file line number Diff line number Diff line change
Expand Up @@ -894,7 +894,7 @@ static int ethoc_probe(struct platform_device *pdev)

mmio = devm_request_mem_region(&pdev->dev, res->start,
res->end - res->start + 1, res->name);
if (!res) {
if (!mmio) {
dev_err(&pdev->dev, "cannot request I/O memory space\n");
ret = -ENXIO;
goto free;
Expand Down

0 comments on commit 463889e

Please sign in to comment.