mtd: ts5500_flash: avoid calling map_destroy on NULL
authorJulia Lawall <julia@diku.dk>
Wed, 2 Feb 2011 17:13:36 +0000 (18:13 +0100)
committerDavid Woodhouse <David.Woodhouse@intel.com>
Fri, 11 Mar 2011 14:22:44 +0000 (14:22 +0000)
commit3ee7451a023dd197fcfc1ba46dcce6d8ec5e1b78
treeb87527fb5eccede4c9236ecd1e521afa1ef02125
parentf17f12ce9dd6ec0a8e1f415ecdbaebfce0207464
mtd: ts5500_flash: avoid calling map_destroy on NULL

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>
drivers/mtd/maps/ts5500_flash.c