]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
sunrpc: Fix compilation error (`make W=1`) when dprintk() is no-op
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Wed, 4 Feb 2026 20:21:51 +0000 (21:21 +0100)
committerChuck Lever <chuck.lever@oracle.com>
Mon, 30 Mar 2026 01:25:09 +0000 (21:25 -0400)
Clang compiler is not happy about set but unused variables:

.../flexfilelayout/flexfilelayoutdev.c:56:9: error: variable 'ret' set but not used [-Werror,-Wunused-but-set-variable]
.../flexfilelayout/flexfilelayout.c:1505:6: error: variable 'err' set but not used [-Werror,-Wunused-but-set-variable]
.../nfs4proc.c:9244:12: error: variable 'ptr' set but not used [-Werror,-Wunused-but-set-variable]

Fix these by forwarding parameters of dprintk() to no_printk().
The positive side-effect is a format-string checker enabled even for the cases
when dprintk() is no-op.

Fixes: d67ae825a59d ("pnfs/flexfiles: Add the FlexFile Layout Driver")
Fixes: fc931582c260 ("nfs41: create_session operation")
Acked-by: Geert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
fs/lockd/svclock.c
include/linux/sunrpc/debug.h
include/linux/sunrpc/sched.h

index e687103e42d1be45d002d116bee33a42e44e9bc1..ee23f5802af14b77b0f0059dfd1777c49c031ec0 100644 (file)
@@ -74,6 +74,11 @@ static const char *nlmdbg_cookie2a(const struct nlm_cookie *cookie)
 
        return buf;
 }
+#else
+static inline const char *nlmdbg_cookie2a(const struct nlm_cookie *cookie)
+{
+       return "???";
+}
 #endif
 
 /*
index 93d1a11ffbfb3b5e79abe80c36e77398430b0216..ab61bed2f7afc97279d7a2577001c3b46c4e61e1 100644 (file)
@@ -38,6 +38,8 @@ extern unsigned int           nlm_debug;
 do {                                                                   \
        ifdebug(fac)                                                    \
                __sunrpc_printk(fmt, ##__VA_ARGS__);                    \
+       else                                                            \
+               no_printk(fmt, ##__VA_ARGS__);                          \
 } while (0)
 
 # define dfprintk_rcu(fac, fmt, ...)                                   \
@@ -46,13 +48,15 @@ do {                                                                        \
                rcu_read_lock();                                        \
                __sunrpc_printk(fmt, ##__VA_ARGS__);                    \
                rcu_read_unlock();                                      \
+       } else {                                                        \
+               no_printk(fmt, ##__VA_ARGS__);                          \
        }                                                               \
 } while (0)
 
 #else
 # define ifdebug(fac)          if (0)
-# define dfprintk(fac, fmt, ...)       do {} while (0)
-# define dfprintk_rcu(fac, fmt, ...)   do {} while (0)
+# define dfprintk(fac, fmt, ...)       no_printk(fmt, ##__VA_ARGS__)
+# define dfprintk_rcu(fac, fmt, ...)   no_printk(fmt, ##__VA_ARGS__)
 #endif
 
 /*
index ccba79ebf8932be0ec0b32d2e4ee00b7cddc6349..0dbdf3722537f9c3958593c64775f8cf639ed007 100644 (file)
@@ -95,10 +95,7 @@ struct rpc_task {
        int                     tk_rpc_status;  /* Result of last RPC operation */
        unsigned short          tk_flags;       /* misc flags */
        unsigned short          tk_timeouts;    /* maj timeouts */
-
-#if IS_ENABLED(CONFIG_SUNRPC_DEBUG) || IS_ENABLED(CONFIG_TRACEPOINTS)
        unsigned short          tk_pid;         /* debugging aid */
-#endif
        unsigned char           tk_priority : 2,/* Task priority */
                                tk_garb_retry : 2,
                                tk_cred_retry : 2;