From: Julia Lawall <julia.lawall@inria.fr>
To: John Ogness <john.ogness@linutronix.de>
Cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de>,
Petr Mladek <pmladek@suse.com>,
Sergey Senozhatsky <sergey.senozhatsky@gmail.com>,
Steven Rostedt <rostedt@goodmis.org>,
linux-kernel@vger.kernel.org, kbuild-all@lists.01.org
Subject: [PATCH] printk: fix ifnullfree.cocci warnings
Date: Fri, 24 Jul 2020 12:05:31 +0200 (CEST) [thread overview]
Message-ID: <alpine.DEB.2.21.2007241203410.2834@hadrien> (raw)
Make the code a little simpler by dropping
some unneeded tests.
Generated by: scripts/coccinelle/free/ifnullfree.cocci
Fixes: c406fbce2054 ("printk: implement syslog")
CC: John Ogness <john.ogness@linutronix.de>
Signed-off-by: kernel test robot <lkp@intel.com>
---
tree: https://git.kernel.org/pub/scm/linux/kernel/git/rt/linux-rt-devel.git linux-5.4.y-rt
head: 5fbf1e70f11dba64cc05c9d85120a3aa7c67a4a2
commit: c406fbce2054efbf812b3d811ed23a872f719db9 [43/325] printk: implement syslog
:::::: branch date: 4 months ago
:::::: commit date: 7 months ago
printk.c | 12 ++++--------
1 file changed, 4 insertions(+), 8 deletions(-)
--- a/kernel/printk/printk.c
+++ b/kernel/printk/printk.c
@@ -1539,10 +1539,8 @@ static int syslog_print_all(char __user
if (clear && !seq)
syslog_clear();
- if (text)
- kfree(text);
- if (msgbuf)
- kfree(msgbuf);
+ kfree(text);
+ kfree(msgbuf);
return len;
}
@@ -1695,10 +1693,8 @@ int do_syslog(int type, char __user *buf
break;
}
out:
- if (msgbuf)
- kfree(msgbuf);
- if (text)
- kfree(text);
+ kfree(msgbuf);
+ kfree(text);
return error;
}
next reply other threads:[~2020-07-24 10:05 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-24 10:05 Julia Lawall [this message]
2020-07-27 13:20 ` [PATCH] printk: fix ifnullfree.cocci warnings John Ogness
2020-08-17 14:22 ` Sebastian Andrzej Siewior
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.DEB.2.21.2007241203410.2834@hadrien \
--to=julia.lawall@inria.fr \
--cc=bigeasy@linutronix.de \
--cc=john.ogness@linutronix.de \
--cc=kbuild-all@lists.01.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pmladek@suse.com \
--cc=rostedt@goodmis.org \
--cc=sergey.senozhatsky@gmail.com \
/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: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).