mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] printk: fix ifnullfree.cocci warnings
@ 2020-07-24 10:05 Julia Lawall
  2020-07-27 13:20 ` John Ogness
  0 siblings, 1 reply; 3+ messages in thread
From: Julia Lawall @ 2020-07-24 10:05 UTC (permalink / raw)
  To: John Ogness
  Cc: Sebastian Andrzej Siewior, Petr Mladek, Sergey Senozhatsky,
	Steven Rostedt, linux-kernel, kbuild-all

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


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

end of thread, other threads:[~2020-08-17 14:22 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-24 10:05 [PATCH] printk: fix ifnullfree.cocci warnings Julia Lawall
2020-07-27 13:20 ` John Ogness
2020-08-17 14:22   ` Sebastian Andrzej Siewior

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®