Thread (35 messages) 35 messages, 10 authors, 2019-01-18

Re: [PATCH 21/21] memblock: drop memblock_alloc_*_nopanic() variants

From: Petr Mladek <pmladek@suse.com>
Date: 2019-01-17 09:28:51
Also in: linux-alpha, linux-arm-kernel, linux-devicetree, linux-mips, linux-mm, linux-s390, linux-sh, linux-um, linux-usb, lkml, sparclinux

On Wed 2019-01-16 15:44:21, Mike Rapoport wrote:
As all the memblock allocation functions return NULL in case of error
rather than panic(), the duplicates with _nopanic suffix can be removed.
[...]
quoted hunk ↗ jump to hunk
diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c
index c4f0a41..ae65221 100644
--- a/kernel/printk/printk.c
+++ b/kernel/printk/printk.c
@@ -1147,17 +1147,14 @@ void __init setup_log_buf(int early)
 	if (!new_log_buf_len)
 		return;
 
-	if (early) {
-		new_log_buf =
-			memblock_alloc(new_log_buf_len, LOG_ALIGN);
-	} else {
-		new_log_buf = memblock_alloc_nopanic(new_log_buf_len,
-							  LOG_ALIGN);
-	}
-
+	new_log_buf = memblock_alloc(new_log_buf_len, LOG_ALIGN);
The above change is enough.
 	if (unlikely(!new_log_buf)) {
-		pr_err("log_buf_len: %lu bytes not available\n",
-			new_log_buf_len);
+		if (early)
+			panic("log_buf_len: %lu bytes not available\n",
+				new_log_buf_len);
panic() is not needed here. printk() will just continue using
the (smaller) static buffer.
+		else
+			pr_err("log_buf_len: %lu bytes not available\n",
+			       new_log_buf_len);
 		return;
 	}
Best Regards,
Petr
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help