mtd: ts5500_flash: avoid calling map_destroy on NULL

Linux-MTD Mailing List linux-mtd at lists.infradead.org
Fri Mar 11 10:59:03 EST 2011


Gitweb:     http://git.infradead.org/?p=mtd-2.6.git;a=commit;h=3ee7451a023dd197fcfc1ba46dcce6d8ec5e1b78
Commit:     3ee7451a023dd197fcfc1ba46dcce6d8ec5e1b78
Parent:     f17f12ce9dd6ec0a8e1f415ecdbaebfce0207464
Author:     Julia Lawall <julia at diku.dk>
AuthorDate: Wed Feb 2 18:13:36 2011 +0100
Committer:  David Woodhouse <David.Woodhouse at intel.com>
CommitDate: Fri Mar 11 14:22:44 2011 +0000

    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 at diku.dk>
    Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy at nokia.com>
    Signed-off-by: David Woodhouse <David.Woodhouse at intel.com>
---
 drivers/mtd/maps/ts5500_flash.c |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)

diff --git a/drivers/mtd/maps/ts5500_flash.c b/drivers/mtd/maps/ts5500_flash.c
index e2147bf..e02dfa9 100644
--- a/drivers/mtd/maps/ts5500_flash.c
+++ b/drivers/mtd/maps/ts5500_flash.c
@@ -94,7 +94,6 @@ static int __init init_ts5500_map(void)
 	return 0;
 
 err1:
-	map_destroy(mymtd);
 	iounmap(ts5500_map.virt);
 err2:
 	return rc;



More information about the linux-mtd-cvs mailing list