From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.0 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_PASS,USER_AGENT_NEOMUTT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 850B4C43387 for ; Thu, 17 Jan 2019 09:28:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 5F49A20851 for ; Thu, 17 Jan 2019 09:28:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728486AbfAQJ2t (ORCPT ); Thu, 17 Jan 2019 04:28:49 -0500 Received: from mx2.suse.de ([195.135.220.15]:51720 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727234AbfAQJ2s (ORCPT ); Thu, 17 Jan 2019 04:28:48 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 66E4FAC7F; Thu, 17 Jan 2019 09:28:45 +0000 (UTC) Date: Thu, 17 Jan 2019 10:28:42 +0100 From: Petr Mladek To: Mike Rapoport Cc: linux-mm@kvack.org, Andrew Morton , Catalin Marinas , Christoph Hellwig , "David S. Miller" , Dennis Zhou , Geert Uytterhoeven , Greentime Hu , Greg Kroah-Hartman , Guan Xuetao , Guo Ren , Heiko Carstens , Mark Salter , Matt Turner , Max Filippov , Michael Ellerman , Michal Simek , Paul Burton , Rich Felker , Richard Weinberger , Rob Herring , Russell King , Stafford Horne , Tony Luck , Vineet Gupta , Yoshinori Sato , devicetree@vger.kernel.org, kasan-dev@googlegroups.com, linux-alpha@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-c6x-dev@linux-c6x.org, linux-ia64@vger.kernel.org, linux-kernel@vger.kernel.org, linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org, linux-s390@vger.kernel.org, linux-sh@vger.kernel.org, linux-snps-arc@lists.infradead.org, linux-um@lists.infradead.org, linux-usb@vger.kernel.org, linux-xtensa@linux-xtensa.org, linuxppc-dev@lists.ozlabs.org, openrisc@lists.librecores.org, sparclinux@vger.kernel.org, uclinux-h8-devel@lists.sourceforge.jp, x86@kernel.org, xen-devel@lists.xenproject.org Subject: Re: [PATCH 21/21] memblock: drop memblock_alloc_*_nopanic() variants Message-ID: <20190117092842.wnvsc6em5mxga3rn@pathway.suse.cz> References: <1547646261-32535-1-git-send-email-rppt@linux.ibm.com> <1547646261-32535-22-git-send-email-rppt@linux.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1547646261-32535-22-git-send-email-rppt@linux.ibm.com> User-Agent: NeoMutt/20170421 (1.8.2) Sender: linux-mips-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mips@vger.kernel.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