lkml.org 
[lkml]   [2019]   [Jan]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 21/21] memblock: drop memblock_alloc_*_nopanic() variants
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.

[...]

> 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

\
 
 \ /
  Last update: 2019-01-17 10:29    [W:0.104 / U:0.084 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site