All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH/Trivial] jffs2: Avoid unneeded 'if' before kfree
@ 2011-06-13 20:16 ` Jesper Juhl
  0 siblings, 0 replies; 4+ messages in thread
From: Jesper Juhl @ 2011-06-13 20:16 UTC (permalink / raw)
  To: linux-kernel; +Cc: linux-mtd, David Woodhouse, trivial

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(-)

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

-- 
Jesper Juhl <jj@chaosbits.net>       http://www.chaosbits.net/
Don't top-post http://www.catb.org/jargon/html/T/top-post.html
Plain text mails only, please.


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH/Trivial] jffs2: Avoid unneeded 'if' before kfree
@ 2011-06-13 20:16 ` Jesper Juhl
  0 siblings, 0 replies; 4+ messages in thread
From: Jesper Juhl @ 2011-06-13 20:16 UTC (permalink / raw)
  To: linux-kernel; +Cc: trivial, David Woodhouse, linux-mtd

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(-)

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

-- 
Jesper Juhl <jj@chaosbits.net>       http://www.chaosbits.net/
Don't top-post http://www.catb.org/jargon/html/T/top-post.html
Plain text mails only, please.

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH/Trivial] jffs2: Avoid unneeded 'if' before kfree
  2011-06-13 20:16 ` Jesper Juhl
@ 2011-06-22  5:35   ` Artem Bityutskiy
  -1 siblings, 0 replies; 4+ messages in thread
From: Artem Bityutskiy @ 2011-06-22  5:35 UTC (permalink / raw)
  To: Jesper Juhl; +Cc: linux-kernel, linux-mtd, David Woodhouse, trivial

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!

-- 
Best Regards,
Artem Bityutskiy


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH/Trivial] jffs2: Avoid unneeded 'if' before kfree
@ 2011-06-22  5:35   ` Artem Bityutskiy
  0 siblings, 0 replies; 4+ messages in thread
From: Artem Bityutskiy @ 2011-06-22  5:35 UTC (permalink / raw)
  To: Jesper Juhl; +Cc: trivial, David Woodhouse, linux-mtd, linux-kernel

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!

-- 
Best Regards,
Artem Bityutskiy

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2011-06-22  5:34 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-06-13 20:16 [PATCH/Trivial] jffs2: Avoid unneeded 'if' before kfree Jesper Juhl
2011-06-13 20:16 ` Jesper Juhl
2011-06-22  5:35 ` Artem Bityutskiy
2011-06-22  5:35   ` Artem Bityutskiy

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.