Skip to content

Commit

Permalink
mtd: ts5500_flash: avoid calling map_destroy on NULL
Browse files Browse the repository at this point in the history
map_destroy dereferences its argument.  The call is furthermore only
reachable when this argument is NULL.  Thus the call is dropped.

The semantic match that finds this problem is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@@
expression *x;
@@

*if (x == NULL)
{ ...
* map_destroy(x);
  ...
  return ...;
}
// </smpl>

Signed-off-by: Julia Lawall <julia@diku.dk>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
  • Loading branch information
Julia Lawall authored and David Woodhouse committed Mar 11, 2011
1 parent f17f12c commit 3ee7451
Showing 1 changed file with 0 additions and 1 deletion.
1 change: 0 additions & 1 deletion drivers/mtd/maps/ts5500_flash.c
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@ static int __init init_ts5500_map(void)
return 0;

err1:
map_destroy(mymtd);
iounmap(ts5500_map.virt);
err2:
return rc;
Expand Down

0 comments on commit 3ee7451

Please sign in to comment.