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 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C9CE8C433F5 for ; Mon, 27 Sep 2021 16:21:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A8A6D6103B for ; Mon, 27 Sep 2021 16:21:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235443AbhI0QXS (ORCPT ); Mon, 27 Sep 2021 12:23:18 -0400 Received: from mail.kernel.org ([198.145.29.99]:40558 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235338AbhI0QXQ (ORCPT ); Mon, 27 Sep 2021 12:23:16 -0400 Received: from oasis.local.home (unknown [209.210.2.165]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 93E676108E; Mon, 27 Sep 2021 16:21:38 +0000 (UTC) Date: Mon, 27 Sep 2021 12:21:38 -0400 From: Steven Rostedt To: Chris Down Cc: Arnd Bergmann , Petr Mladek , Sergey Senozhatsky , Andy Shevchenko , Jessica Yu , Arnd Bergmann , John Ogness , Nathan Chancellor , Nick Desaulniers , YueHaibing , linux-kernel@vger.kernel.org, llvm@lists.linux.dev Subject: Re: [PATCH] printk: avoid -Wsometimes-uninitialized warning Message-ID: <20210927122138.56cb1d8e@oasis.local.home> In-Reply-To: References: <20210927125007.1581919-1-arnd@kernel.org> X-Mailer: Claws Mail 3.18.0 (GTK+ 2.24.33; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 27 Sep 2021 14:19:18 +0100 Chris Down wrote: > Having IS_ENABLED and then an #ifdef seems to hurt code readability to me. I agree. Would this be a better solution? -- Steve diff --git a/kernel/printk/index.c b/kernel/printk/index.c index d3709408debe..ce3a0c8c5770 100644 --- a/kernel/printk/index.c +++ b/kernel/printk/index.c @@ -26,10 +26,10 @@ static struct pi_entry *pi_get_entry(const struct module *mod, loff_t pos) if (mod) { entries = mod->printk_index_start; nr_entries = mod->printk_index_size; - } + } else #endif + { - if (!mod) { /* vmlinux, comes from linker symbols */ entries = __start_printk_index; nr_entries = __stop_printk_index - __start_printk_index;