[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Xen-devel] [PATCH 21/21] memblock: drop memblock_alloc_*_nopanic() variants
- To: Mike Rapoport <rppt@xxxxxxxxxxxxx>
- From: Petr Mladek <pmladek@xxxxxxxx>
- Date: Thu, 17 Jan 2019 10:28:42 +0100
- Cc: Rich Felker <dalias@xxxxxxxx>, linux-ia64@xxxxxxxxxxxxxxx, linux-sh@xxxxxxxxxxxxxxx, Catalin Marinas <catalin.marinas@xxxxxxx>, Heiko Carstens <heiko.carstens@xxxxxxxxxx>, linux-mips@xxxxxxxxxxxxxxx, Max Filippov <jcmvbkbc@xxxxxxxxx>, Guo Ren <guoren@xxxxxxxxxx>, sparclinux@xxxxxxxxxxxxxxx, Christoph Hellwig <hch@xxxxxx>, linux-s390@xxxxxxxxxxxxxxx, linux-c6x-dev@xxxxxxxxxxxxx, Yoshinori Sato <ysato@xxxxxxxxxxxxxxxxxxxx>, Richard Weinberger <richard@xxxxxx>, x86@xxxxxxxxxx, Russell King <linux@xxxxxxxxxxxxxxx>, kasan-dev@xxxxxxxxxxxxxxxx, Geert Uytterhoeven <geert@xxxxxxxxxxxxxx>, Mark Salter <msalter@xxxxxxxxxx>, Dennis Zhou <dennis@xxxxxxxxxx>, Matt Turner <mattst88@xxxxxxxxx>, linux-snps-arc@xxxxxxxxxxxxxxxxxxx, uclinux-h8-devel@xxxxxxxxxxxxxxxxxxxx, devicetree@xxxxxxxxxxxxxxx, linux-xtensa@xxxxxxxxxxxxxxxx, linux-alpha@xxxxxxxxxxxxxxx, linux-um@xxxxxxxxxxxxxxxxxxx, linux-m68k@xxxxxxxxxxxxxxxxxxxx, Rob Herring <robh+dt@xxxxxxxxxx>, Greentime Hu <green.hu@xxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx, Stafford Horne <shorne@xxxxxxxxx>, Guan Xuetao <gxt@xxxxxxxxxx>, linux-arm-kernel@xxxxxxxxxxxxxxxxxxx, Michal Simek <monstr@xxxxxxxxx>, Tony Luck <tony.luck@xxxxxxxxx>, linux-mm@xxxxxxxxx, Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>, linux-usb@xxxxxxxxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx, Paul Burton <paul.burton@xxxxxxxx>, Vineet Gupta <vgupta@xxxxxxxxxxxx>, Michael Ellerman <mpe@xxxxxxxxxxxxxx>, Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>, linuxppc-dev@xxxxxxxxxxxxxxxx, "David S. Miller" <davem@xxxxxxxxxxxxx>, openrisc@xxxxxxxxxxxxxxxxxxxx
- Delivery-date: Thu, 17 Jan 2019 09:29:55 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
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
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel
|