jffs2: Avoid unneeded 'if' before kfree

Linux-MTD Mailing List linux-mtd at lists.infradead.org
Mon Nov 7 11:59:19 EST 2011


Gitweb:     http://git.infradead.org/?p=mtd-2.6.git;a=commit;h=e8a0e41266e9c207ad8ac158cee9547ef1bc90ac
Commit:     e8a0e41266e9c207ad8ac158cee9547ef1bc90ac
Parent:     e638275e18a929103bb087acb94d2b67eb0818e0
Author:     Jesper Juhl <jj at chaosbits.net>
AuthorDate: Mon Jun 13 22:16:44 2011 +0200
Committer:  Artem Bityutskiy <artem.bityutskiy at intel.com>
CommitDate: Sun Sep 11 15:02:10 2011 +0300

    jffs2: Avoid unneeded 'if' before kfree
    
    kfree() deals gracefully with NULL pointers, so it's pointless to test for
    one prior to calling it.
    This removes such a test from jffs2_scan_medium().
    
    Signed-off-by: Jesper Juhl <jj at chaosbits.net>
    Signed-off-by: Artem Bityutskiy <dedekind1 at gmail.com>
---
 fs/jffs2/scan.c |    4 +---
 1 files changed, 1 insertions(+), 3 deletions(-)

diff --git a/fs/jffs2/scan.c b/fs/jffs2/scan.c
index 8d8cd34..28107ca 100644
--- a/fs/jffs2/scan.c
+++ b/fs/jffs2/scan.c
@@ -275,9 +275,7 @@ int jffs2_scan_medium(struct jffs2_sb_info *c)
 	else
 		c->mtd->unpoint(c->mtd, 0, c->mtd->size);
 #endif
-	if (s)
-		kfree(s);
-
+	kfree(s);
 	return ret;
 }
 



More information about the linux-mtd-cvs mailing list