Thread (17 messages) 17 messages, 5 authors, 2026-02-04

Re: [PATCH v2 3/3] sunrpc: Fix compilation error (`make W=1`) when dprintk() is no-op

From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Date: 2026-02-04 16:59:00
Also in: linux-nfs, lkml, llvm
Subsystem: kernel nfsd, sunrpc, and lockd servers, nfs, sunrpc, and lockd clients, the rest · Maintainers: Chuck Lever, Jeff Layton, Trond Myklebust, Anna Schumaker, Linus Torvalds

On Wed, Feb 04, 2026 at 06:46:36PM +0200, Andy Shevchenko wrote:
On Wed, Feb 04, 2026 at 10:41:23AM +0100, Andy Shevchenko wrote:
quoted
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.
I'm afraid this is not end of story...
I received a dozen of minutes ago a new report and now I'm investigating.

Patches 1 & 2 though are ready to go.
Okay, if I'm not mistaken the only leftover is the missing tk_pid field due to
conditional inclusion. However, if we do that unconditionally the data structure
won't be expanded (there is a gap of 3 bytes. (Dunno about m68k, there may be
actually +2 bytes due to 2-byte alignment.) The rest of the conditionally included
members seem not being used in dprintk().

That said, removing ifdeffery around tk_pid in struct rpc_task should fix that
problem.

If you can fold this to the patch 3, would be nice:
diff --git a/include/linux/sunrpc/sched.h b/include/linux/sunrpc/sched.h
index ccba79ebf893..0dbdf3722537 100644
--- a/include/linux/sunrpc/sched.h
+++ b/include/linux/sunrpc/sched.h
@@ -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;
Otherwise I can send a new version.

-- 
With Best Regards,
Andy Shevchenko

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help