Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp198388rdg; Thu, 12 Oct 2023 03:08:25 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGyRv1bA8GMFzNWmHxQncm2sP8SxBKCBZD16iKGIGdAJuR9pi/jghsGaffEKSlt9SDoygew X-Received: by 2002:a17:903:4307:b0:1c9:dbd3:94f7 with SMTP id jz7-20020a170903430700b001c9dbd394f7mr1866037plb.65.1697105305392; Thu, 12 Oct 2023 03:08:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697105305; cv=none; d=google.com; s=arc-20160816; b=IpFlh5krH9JrHWQAQmKkFk2LVc5hItmEjQrw2vhLJP0OxoNQgy9b3FYEMNs/UEDmfE Pbrvvb8/jG9uIHD2JjWhtZhXNXosbMbEI6BM+WArn37Xid3S0qImJwFvIiRrMx7S4PYT ryK11XMATYUAPbQ4ySGbfr1TpDebZLaXgXUGGUNqf+p6adeWydhChgq8KjsJfqQ5DmE4 2I+30Ll5ie3Mnp9SJ83c/yTx9fi8GQO2p+Xq3/wr8y+o87mW5JROpHKj4kBdGcSBBHAv 2OHhKXXIWVDF3q1eiZ2VaJpRGfTH//h/Z/pnWPcl4ULL8kkVYsR4fW1c9PXfKZKQJznf ogZw== 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 :message-id:date:subject:cc:to:from; bh=ANBdJxb4exC/SuZmIQRzD5eW7AMj/Ns60LRhxT1SfYk=; fh=UQBNt8qzbI9LUMF9Fa69yl3jp8HHO1Oy26uQBA7jD1M=; b=SoCMds2DNQJ0VnLI23h6mDrG47SVwBC75MlHAyihLkEbZ9lpIyP05SnBVIkJ40qpLj gQ9JcmTIomnni+W2f4ePktjTkhUqRDQEQ7JgGV8YaNJy0S6rp/bMVvnBElS3vCutmCHh I6yDkaWq1wieXv83EuxgE7rMZvgehsevO3L/OFCPIElWYuARBmscAdNjGdxLnlRhChfc seZ/gugzC/nA/mRVVniWwlpHL4X0R09jDQA6yq07uZVJ064QsaQQ3RDPp8LERI4g8Tza 3leOjkuX+jx+o4tAb+BlVSCZm0fMblJdxePBewc6MyQ0SWh5iZN3/WIO8EVC3JiIMbsU 828Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org Return-Path: Received: from agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id t15-20020a1709027fcf00b001c631664c4bsi1734629plb.200.2023.10.12.03.08.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Oct 2023 03:08:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id CD801818CC9D; Thu, 12 Oct 2023 03:08:18 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343760AbjJLKIR (ORCPT + 99 others); Thu, 12 Oct 2023 06:08:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54844 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235457AbjJLKIQ (ORCPT ); Thu, 12 Oct 2023 06:08:16 -0400 Received: from albert.telenet-ops.be (albert.telenet-ops.be [IPv6:2a02:1800:110:4::f00:1a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C7C869D for ; Thu, 12 Oct 2023 03:08:13 -0700 (PDT) Received: from ramsan.of.borg ([IPv6:2a02:1810:ac12:ed40:b72e:818:7fe2:593d]) by albert.telenet-ops.be with bizsmtp id wy872A00A56sUls06y87rb; Thu, 12 Oct 2023 12:08:10 +0200 Received: from rox.of.borg ([192.168.97.57]) by ramsan.of.borg with esmtp (Exim 4.95) (envelope-from ) id 1qqsbs-0068cO-Ox; Thu, 12 Oct 2023 12:08:07 +0200 Received: from geert by rox.of.borg with local (Exim 4.95) (envelope-from ) id 1qqsbv-001VAj-0c; Thu, 12 Oct 2023 12:08:07 +0200 From: Geert Uytterhoeven To: Chuck Lever , Jeff Layton , Neil Brown , Olga Kornievskaia , Dai Ngo , Tom Talpey , Trond Myklebust , Anna Schumaker Cc: linux-nfs@vger.kernel.org, linux-kernel@vger.kernel.org, Geert Uytterhoeven Subject: [PATCH -next v2] sunrpc: Use no_printk() in dfprintk*() dummies Date: Thu, 12 Oct 2023 12:08:05 +0200 Message-Id: X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Thu, 12 Oct 2023 03:08:19 -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(), as its reference is now visible to the compiler, but optimized away. Signed-off-by: Geert Uytterhoeven --- 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..119a0c31d30eed4f 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