aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/printk.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/printk.c')
-rw-r--r--kernel/printk.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/kernel/printk.c b/kernel/printk.c
index 19c0d7bcf24a..357f714ddd49 100644
--- a/kernel/printk.c
+++ b/kernel/printk.c
@@ -870,10 +870,11 @@ static size_t print_time(u64 ts, char *buf)
870 if (!printk_time) 870 if (!printk_time)
871 return 0; 871 return 0;
872 872
873 rem_nsec = do_div(ts, 1000000000);
874
873 if (!buf) 875 if (!buf)
874 return 15; 876 return snprintf(NULL, 0, "[%5lu.000000] ", (unsigned long)ts);
875 877
876 rem_nsec = do_div(ts, 1000000000);
877 return sprintf(buf, "[%5lu.%06lu] ", 878 return sprintf(buf, "[%5lu.%06lu] ",
878 (unsigned long)ts, rem_nsec / 1000); 879 (unsigned long)ts, rem_nsec / 1000);
879} 880}