[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200717234818.8622-5-john.ogness@linutronix.de>
Date: Sat, 18 Jul 2020 01:54:18 +0206
From: John Ogness <john.ogness@...utronix.de>
To: Petr Mladek <pmladek@...e.com>
Cc: Sergey Senozhatsky <sergey.senozhatsky.work@...il.com>,
Sergey Senozhatsky <sergey.senozhatsky@...il.com>,
Steven Rostedt <rostedt@...dmis.org>,
Linus Torvalds <torvalds@...ux-foundation.org>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Peter Zijlstra <peterz@...radead.org>,
Thomas Gleixner <tglx@...utronix.de>,
kexec@...ts.infradead.org, linux-kernel@...r.kernel.org
Subject: [PATCH 4/4] ipconfig: cleanup printk usage
The use of pr_info() and pr_cont() was not ordered correctly for
all cases. Order it so that all cases provide the expected output.
Signed-off-by: John Ogness <john.ogness@...utronix.de>
---
net/ipv4/ipconfig.c | 25 +++++++++++++++++--------
1 file changed, 17 insertions(+), 8 deletions(-)
diff --git a/net/ipv4/ipconfig.c b/net/ipv4/ipconfig.c
index 561f15b5a944..0f4bd7a59310 100644
--- a/net/ipv4/ipconfig.c
+++ b/net/ipv4/ipconfig.c
@@ -1442,6 +1442,9 @@ static int __init ip_auto_config(void)
#endif
int err;
unsigned int i;
+#ifndef IPCONFIG_SILENT
+ bool pr0;
+#endif
/* Initialise all name servers and NTP servers to NONE (but only if the
* "ip=" or "nfsaddrs=" kernel command line parameters weren't decoded,
@@ -1575,31 +1578,37 @@ static int __init ip_auto_config(void)
if (ic_dev_mtu)
pr_cont(", mtu=%d", ic_dev_mtu);
/* Name servers (if any): */
+ pr0 = false;
for (i = 0; i < CONF_NAMESERVERS_MAX; i++) {
if (ic_nameservers[i] != NONE) {
- if (i == 0)
+ if (!pr0) {
pr_info(" nameserver%u=%pI4",
i, &ic_nameservers[i]);
- else
+ pr0 = true;
+ } else {
pr_cont(", nameserver%u=%pI4",
i, &ic_nameservers[i]);
+ }
}
- if (i + 1 == CONF_NAMESERVERS_MAX)
- pr_cont("\n");
}
+ if (pr0)
+ pr_cont("\n");
/* NTP servers (if any): */
+ pr0 = false;
for (i = 0; i < CONF_NTP_SERVERS_MAX; i++) {
if (ic_ntp_servers[i] != NONE) {
- if (i == 0)
+ if (!pr0) {
pr_info(" ntpserver%u=%pI4",
i, &ic_ntp_servers[i]);
- else
+ pr0 = true;
+ } else {
pr_cont(", ntpserver%u=%pI4",
i, &ic_ntp_servers[i]);
+ }
}
- if (i + 1 == CONF_NTP_SERVERS_MAX)
- pr_cont("\n");
}
+ if (pr0)
+ pr_cont("\n");
#endif /* !SILENT */
/*
--
2.20.1
Powered by blists - more mailing lists