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=-8.2 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_SANE_1 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 858F9C10F27 for ; Tue, 10 Mar 2020 12:17:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 64CB024686 for ; Tue, 10 Mar 2020 12:17:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726380AbgCJMRy (ORCPT ); Tue, 10 Mar 2020 08:17:54 -0400 Received: from foss.arm.com ([217.140.110.172]:34848 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726211AbgCJMRy (ORCPT ); Tue, 10 Mar 2020 08:17:54 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 1B1ED30E; Tue, 10 Mar 2020 05:17:53 -0700 (PDT) Received: from lakrids.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.121.207.14]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 593743F67D; Tue, 10 Mar 2020 05:17:52 -0700 (PDT) Date: Tue, 10 Mar 2020 12:17:47 +0000 From: Mark Rutland To: Stephen Rothwell , Theodore Ts'o Cc: Linux Next Mailing List , Linux Kernel Mailing List Subject: Re: linux-next: build warning after merge of the random tree Message-ID: <20200310121747.GA49602@lakrids.cambridge.arm.com> References: <20200302144452.6a7c4907@canb.auug.org.au> <20200306155348.7bdc9622@canb.auug.org.au> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200306155348.7bdc9622@canb.auug.org.au> User-Agent: Mutt/1.11.1+11 (2f07cb52) (2018-12-01) Sender: linux-next-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-next@vger.kernel.org On Fri, Mar 06, 2020 at 03:53:48PM +1100, Stephen Rothwell wrote: > Hi all, > > On Mon, 2 Mar 2020 14:44:52 +1100 Stephen Rothwell wrote: > > > > After merging the random tree, today's linux-next build (x86_64 > > allnoconfig) produced this warning: > > > > drivers/char/random.c:820:13: warning: 'crng_initialize_secondary' defined but not used [-Wunused-function] > > 820 | static void crng_initialize_secondary(struct crng_state *crng) > > | ^~~~~~~~~~~~~~~~~~~~~~~~~ > > > > Introduced by commit > > > > 5cbe0f13b51a ("random: split primary/secondary crng init paths") > > I am still getting this warning. Sorry, this is my bad. We only call crng_initialize_secondary() in do_numa_crng_init(), which is only built for CONFIG_NUMA. We can either drop both crng_initialize_secondary() and crng_init_try_arch() under the CONFIG_NUMA ifdef, or add __maybe_unused to crng_initialize_secondary(). Ted, does the below look ok to you? Or would you prefer moving things under the ifdeffery? Thanks, Mark. ---->8---- >From 6c3a35cd562d53066e11f5f8a6c3a6f63701d3ed Mon Sep 17 00:00:00 2001 From: Mark Rutland Date: Tue, 10 Mar 2020 12:09:12 +0000 Subject: [PATCH] random: avoid warnings for !CONFIG_NUMA builds As crng_initialize_secondary() is only called by do_numa_crng_init(), and the latter is under ifdeffery for CONFIG_NUMA, when CONFIG_NUMA is not selected the compiler will warn that the former is unused: | drivers/char/random.c:820:13: warning: 'crng_initialize_secondary' defined but not used [-Wunused-function] | 820 | static void crng_initialize_secondary(struct crng_state *crng) | | ^~~~~~~~~~~~~~~~~~~~~~~~~ Stephen reports that this happens for x86_64 noallconfig builds. We could move crng_initialize_secondary() and crng_init_try_arch() under the CONFIG_NUMA ifdeffery, but this has the unfortunate property of separating them from crng_initialize_primary() and crng_init_try_arch_early() respectively. Instead, let's mark crng_initialize_secondary() as __maybe_unused. Fixes: 5cbe0f13b51a ("random: split primary/secondary crng init paths") Reported-by: Stephen Rothwell Signed-off-by: Mark Rutland Cc: Theodore Ts'o --- drivers/char/random.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/char/random.c b/drivers/char/random.c index f43f65c2195d..0d10e31fd342 100644 --- a/drivers/char/random.c +++ b/drivers/char/random.c @@ -817,7 +817,7 @@ static bool __init crng_init_try_arch_early(struct crng_state *crng) return arch_init; } -static void crng_initialize_secondary(struct crng_state *crng) +static void __maybe_unused crng_initialize_secondary(struct crng_state *crng) { memcpy(&crng->state[0], "expand 32-byte k", 16); _get_random_bytes(&crng->state[4], sizeof(__u32) * 12); -- 2.11.0