]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
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)
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

index e2147bf11c88948036c6d4d696b38f7952e62f01..e02dfa9d4ddd8279890ec3daf1c91c0a0af90190 100644 (file)
@@ -94,7 +94,6 @@ static int __init init_ts5500_map(void)
        return 0;
 
 err1:
-       map_destroy(mymtd);
        iounmap(ts5500_map.virt);
 err2:
        return rc;