Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp2486026rdg; Mon, 16 Oct 2023 06:09:32 -0700 (PDT) X-Google-Smtp-Source: AGHT+IENlDfMZOcAjzvP1HmKd3YUXYKyFTo+h2xsSTkT1xJ2auIb39+MizJ6mo4AWUIeqtW64Sww X-Received: by 2002:a17:902:ecc5:b0:1c6:e8d:29ea with SMTP id a5-20020a170902ecc500b001c60e8d29eamr35994735plh.60.1697461771731; Mon, 16 Oct 2023 06:09:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697461771; cv=none; d=google.com; s=arc-20160816; b=H+kiTq9eCDG6r/Dws0wT4Q0xRY2/WYB0E43QFjvQkby5G2BPohOhRvo+Xif0bFgWGc JN7aGPMoaqmHzw5WCl2B/H8I66wsYpPzdJpxEL8ugPJkVEoOKUM8Y2zNyJkj4nKBpeok b7z+V+hLwEeljM0cBJv+IBB7j/uTo4MgLGd5fpZPu3j5l8Jv8NGxy+6ejyxj0EQ/hgvb 8IUYqXRA5stxUA9A3X657BjdblZdGW27hoyg1pOETxnJmuxA7eY+29T1mkz1SeJXDgWB +DYPno/0/KTk48LzPSDEAM07KlSThIbcNq3lP+r0LtR/mVFZ6+AguHdUihfg6BfKJO58 dwUg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=i12Az7M/JI7dzzbK7qtslxQug26+3QQF/dI56rD6Aec=; fh=sJsIcL0ReSbnc/UOjFPI72n0J96MpDCb1aBqZkAAi+I=; b=qEIZNjWKS+EAWh4/3oZyZcnS5VhNYjYIPEtayCia596xi2zDufVpymZX7QGQMZwv0j H8cqFkL7ZTTBIkQpWwaVuLUtKwPenlf312UlmX0figYg5Y/HMvZ1EvFrNsb8sTHPnvg+ Pu3Uy3feC+BVnX4Wgi+dKEQ6rOezRHVQ4crlaqVcuSy4suhnFUr/EInN2Lpx1FpT74cu vqvSsr3nY0d5rd7cmb8g3EDqJKfu3OLzjGLTrDO6zeJPzov6GMCLyos6q4w+54FjgE2X lo/rvROkXefFefMQuKh2xtYvFNYifOMwyEXPFQkrkfF/CMxkZksTYAkjwcAaoIBZLc4x kWKQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id y5-20020a170902ed4500b001b674055d72si2102528plb.621.2023.10.16.06.09.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Oct 2023 06:09:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 9EC8F80ACB62; Mon, 16 Oct 2023 06:09:30 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231569AbjJPNJ1 (ORCPT + 99 others); Mon, 16 Oct 2023 09:09:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54604 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230017AbjJPNJ0 (ORCPT ); Mon, 16 Oct 2023 09:09:26 -0400 Received: from xavier.telenet-ops.be (xavier.telenet-ops.be [IPv6:2a02:1800:120:4::f00:14]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 148209B for ; Mon, 16 Oct 2023 06:09:24 -0700 (PDT) Received: from ramsan.of.borg ([IPv6:2a02:1810:ac12:ed40:ce84:d8c0:f79a:fa0]) by xavier.telenet-ops.be with bizsmtp id yd9M2A0010pDX7N01d9Mei; Mon, 16 Oct 2023 15:09:23 +0200 Received: from rox.of.borg ([192.168.97.57]) by ramsan.of.borg with esmtp (Exim 4.95) (envelope-from ) id 1qsNLR-006jYw-EV; Mon, 16 Oct 2023 15:09:20 +0200 Received: from geert by rox.of.borg with local (Exim 4.95) (envelope-from ) id 1qsNLU-00A9nZ-SG; Mon, 16 Oct 2023 15:09:20 +0200 From: Geert Uytterhoeven To: Trond Myklebust , Anna Schumaker , Chuck Lever , Jeff Layton , Neil Brown , Olga Kornievskaia , Dai Ngo , Tom Talpey Cc: linux-nfs@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Geert Uytterhoeven Subject: [PATCH -next v3 2/2] sunrpc: Use no_printk() in dfprintk*() dummies Date: Mon, 16 Oct 2023 15:09:19 +0200 Message-Id: <180fd042261dcd4243fad90660b114b8f0a78dcd.1697460614.git.geert+renesas@glider.be> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.3 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Mon, 16 Oct 2023 06:09:30 -0700 (PDT) When building NFS with W=1 and CONFIG_WERROR=y, but CONFIG_SUNRPC_DEBUG=n: fs/nfs/nfs4proc.c: In function ‘nfs4_proc_create_session’: fs/nfs/nfs4proc.c:9276:19: error: variable ‘ptr’ set but not used [-Werror=unused-but-set-variable] 9276 | unsigned *ptr; | ^~~ CC fs/nfs/callback.o fs/nfs/callback.c: In function ‘nfs41_callback_svc’: fs/nfs/callback.c:98:13: error: variable ‘error’ set but not used [-Werror=unused-but-set-variable] 98 | int error; | ^~~~~ CC fs/nfs/flexfilelayout/flexfilelayout.o fs/nfs/flexfilelayout/flexfilelayout.c: In function ‘ff_layout_io_track_ds_error’: fs/nfs/flexfilelayout/flexfilelayout.c:1230:13: error: variable ‘err’ set but not used [-Werror=unused-but-set-variable] 1230 | int err; | ^~~ CC fs/nfs/flexfilelayout/flexfilelayoutdev.o fs/nfs/flexfilelayout/flexfilelayoutdev.c: In function ‘nfs4_ff_alloc_deviceid_node’: fs/nfs/flexfilelayout/flexfilelayoutdev.c:55:16: error: variable ‘ret’ set but not used [-Werror=unused-but-set-variable] 55 | int i, ret = -ENOMEM; | ^~~ All these are due to variables that are set unconditionally, but are used only when debugging is enabled. Fix this by changing the dfprintk*() dummy macros from empty loops to calls to the no_printk() helper. This informs the compiler that the passed debug parameters are actually used, and enables format specifier checking as a bonus. This requires removing the protection by CONFIG_SUNRPC_DEBUG of the declaration of nlmdbg_cookie2a() in fs/lockd/svclock.c, as its reference is now visible to the compiler, but optimized away. Signed-off-by: Geert Uytterhoeven Acked-by: Jeff Layton --- v3: - Add Acked-by, v2: - s/uncontionally/unconditionally/, - Drop CONFIG_SUNRPC_DEBUG check in fs/lockd/svclock.c to fix build failure. --- fs/lockd/svclock.c | 2 -- include/linux/sunrpc/debug.h | 6 +++--- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/fs/lockd/svclock.c b/fs/lockd/svclock.c index 43aeba9de55cbbc5..b80e0e143c5db16a 100644 --- a/fs/lockd/svclock.c +++ b/fs/lockd/svclock.c @@ -55,7 +55,6 @@ static const struct rpc_call_ops nlmsvc_grant_ops; static LIST_HEAD(nlm_blocked); static DEFINE_SPINLOCK(nlm_blocked_lock); -#if IS_ENABLED(CONFIG_SUNRPC_DEBUG) static const char *nlmdbg_cookie2a(const struct nlm_cookie *cookie) { /* @@ -82,7 +81,6 @@ static const char *nlmdbg_cookie2a(const struct nlm_cookie *cookie) return buf; } -#endif /* * Insert a blocked lock into the global list diff --git a/include/linux/sunrpc/debug.h b/include/linux/sunrpc/debug.h index f6aeed07fe04e3d5..76539c6673f2fb15 100644 --- a/include/linux/sunrpc/debug.h +++ b/include/linux/sunrpc/debug.h @@ -67,9 +67,9 @@ do { \ # define RPC_IFDEBUG(x) x #else # define ifdebug(fac) if (0) -# define dfprintk(fac, fmt, ...) do {} while (0) -# define dfprintk_cont(fac, fmt, ...) do {} while (0) -# define dfprintk_rcu(fac, fmt, ...) do {} while (0) +# define dfprintk(fac, fmt, ...) no_printk(fmt, ##__VA_ARGS__) +# define dfprintk_cont(fac, fmt, ...) no_printk(fmt, ##__VA_ARGS__) +# define dfprintk_rcu(fac, fmt, ...) no_printk(fmt, ##__VA_ARGS__) # define RPC_IFDEBUG(x) #endif -- 2.34.1