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

From: Andy Shevchenko

Date: Tue Feb 03 2026 - 20:09:24 EST


On Wed, Feb 04, 2026 at 02:04:15AM +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.

Note, the alternative fix is to add __maybe_unused all over the place.
With pros and cons I consider my approach better.

--
With Best Regards,
Andy Shevchenko