diff mbox

[PATCH/Trivial] jffs2: Avoid unneeded 'if' before kfree

Message ID alpine.LNX.2.00.1106132213500.30934@swampdragon.chaosbits.net
State Accepted, archived
Headers show

Commit Message

Jesper Juhl June 13, 2011, 8:16 p.m. UTC
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@chaosbits.net>
---
 scan.c |    4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

Comments

Artem Bityutskiy June 22, 2011, 5:35 a.m. UTC | #1
On Mon, 2011-06-13 at 22:16 +0200, Jesper Juhl wrote:
> 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@chaosbits.net>

Pushed to l2-mtd-2.6.git, thanks!
diff mbox

Patch

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;
 }