Thread (11 messages) 11 messages, 2 authors, 2026-02-18

Re: [PATCH v2 1/2] nfs: fix unused variable warnings

flat view

From: Sean <hidden>
Date: 2026-02-17 09:55:56
Also in: linux-nfs, lkml

On Tue, Feb 17, 2026 at 4:06 AM Andrew Lunn [off-list ref] wrote:

There is no #ifdef'ery here. How is ptr not used? Is status always
true, so the goto it always taken? But then rpcdata should also be
unused?
If CONFIG_SUNRPC_DEBUG is not enabled, dprintk expands to
do {} while (0) during preprocessing. This means unsigned *ptr has
no remaining references in the function, as its only 'read' was inside
the macro.

Regarding rpcdata, the compiler's unused-variable check doesn't care if a
specific branch (like the goto out) might skip the variable's usage at runtime.
As long as there is at least one valid code path where the variable is
referenced
which there is for rpcdata in the call to
rpc_clnt_probe_trunked_xprts() -> the warning is avoided.
For ptr, the macro expansion leaves it with zero references in any path.

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