Re: [PATCH v2 3/3] sunrpc: Fix compilation error (`make W=1`) when dprintk() is no-op
From: Andy Shevchenko
Date: Wed Feb 04 2026 - 12:05:40 EST
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:
> > 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