From: Jesper Juhl <jj@chaosbits.net> To: linux-kernel@vger.kernel.org Cc: linux-mtd@lists.infradead.org, David Woodhouse <dwmw2@infradead.org>, trivial@kernel.org Subject: [PATCH/Trivial] jffs2: Avoid unneeded 'if' before kfree Date: Mon, 13 Jun 2011 22:16:44 +0200 (CEST) [thread overview] Message-ID: <alpine.LNX.2.00.1106132213500.30934@swampdragon.chaosbits.net> (raw) 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.
WARNING: multiple messages have this Message-ID (diff)
From: Jesper Juhl <jj@chaosbits.net> To: linux-kernel@vger.kernel.org Cc: trivial@kernel.org, David Woodhouse <dwmw2@infradead.org>, linux-mtd@lists.infradead.org Subject: [PATCH/Trivial] jffs2: Avoid unneeded 'if' before kfree Date: Mon, 13 Jun 2011 22:16:44 +0200 (CEST) [thread overview] Message-ID: <alpine.LNX.2.00.1106132213500.30934@swampdragon.chaosbits.net> (raw) 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.
next reply other threads:[~2011-06-13 20:25 UTC|newest] Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top 2011-06-13 20:16 Jesper Juhl [this message] 2011-06-13 20:16 ` [PATCH/Trivial] jffs2: Avoid unneeded 'if' before kfree Jesper Juhl 2011-06-22 5:35 ` Artem Bityutskiy 2011-06-22 5:35 ` Artem Bityutskiy
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=alpine.LNX.2.00.1106132213500.30934@swampdragon.chaosbits.net \ --to=jj@chaosbits.net \ --cc=dwmw2@infradead.org \ --cc=linux-kernel@vger.kernel.org \ --cc=linux-mtd@lists.infradead.org \ --cc=trivial@kernel.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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.