[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1480432743-8049-1-git-send-email-sebastian.duda@fau.de>
Date: Tue, 29 Nov 2016 16:19:01 +0100
From: Sebastian Duda <sebastian.duda@....de>
To: unlisted-recipients:; (no To-header on input)
Cc: linux-kernel@...cs.fau.de, Sebastian Duda <sebastian.duda@....de>,
Tobias Baumeister <tobias.baumeister@....de>,
Andrew Morton <akpm@...ux-foundation.org>,
Petr Mladek <pmladek@...e.com>,
Sergey Senozhatsky <sergey.senozhatsky@...il.com>,
Borislav Petkov <bp@...e.de>, Tejun Heo <tj@...nel.org>,
Thierry Reding <treding@...dia.com>,
linux-kernel@...r.kernel.org (open list)
Subject: [PATCH] printk.c: removed unnecessary code
snprintf((char *) ?, 0, ...); always returns Zero and doesn't change the data.
Thus the execution of
snprintf(NULL, 0, "[%5lu.000000] ", (unsigned long)ts);
has no effect on program.
The substitution with 0 increases the readability of the code.
Signed-off-by: Sebastian Duda <sebastian.duda@....de>
Signed-off-by: Tobias Baumeister <tobias.baumeister@....de>
---
kernel/printk/printk.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c
index 5028f4f..fe3fec1 100644
--- a/kernel/printk/printk.c
+++ b/kernel/printk/printk.c
@@ -1186,7 +1186,7 @@ static size_t print_time(u64 ts, char *buf)
rem_nsec = do_div(ts, 1000000000);
if (!buf)
- return snprintf(NULL, 0, "[%5lu.000000] ", (unsigned long)ts);
+ return 0;
return sprintf(buf, "[%5lu.%06lu] ",
(unsigned long)ts, rem_nsec / 1000);
--
2.7.4
Powered by blists - more mailing lists