Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Julia Lawall and committed by
David Woodhouse
3ee7451a f17f12ce

-1
-1
drivers/mtd/maps/ts5500_flash.c
··· 94 94 return 0; 95 95 96 96 err1: 97 - map_destroy(mymtd); 98 97 iounmap(ts5500_map.virt); 99 98 err2: 100 99 return rc;