public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Andrew Lunn <andrew@lunn.ch>
To: Sean Chang <seanwascoding@gmail.com>
Cc: nicolas.ferre@microchip.com, claudiu.beznea@tuxon.dev,
	trond.myklebust@hammerspace.com, anna@kernel.org,
	netdev@vger.kernel.org, linux-nfs@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 1/2] nfs: fix unused variable warnings
Date: Mon, 16 Feb 2026 21:06:50 +0100	[thread overview]
Message-ID: <2e3bf4db-cea6-4f55-a82b-4e99bb3f44fe@lunn.ch> (raw)
In-Reply-To: <20260216174950.455244-2-seanwascoding@gmail.com>

On Tue, Feb 17, 2026 at 01:49:49AM +0800, Sean Chang wrote:
> Add __maybe_unused to variables only used in specific configurations
> to silence compiler warnings found during RISC-V builds.

Could you give more details.

>  int nfs4_proc_create_session(struct nfs_client *clp, const struct cred *cred)
>  {
>  	int status;
> -	unsigned *ptr;
> +	unsigned *ptr __maybe_unused;
>  	struct nfs4_session *session = clp->cl_session;
>  	struct nfs4_add_xprt_data xprtdata = {
>  		.clp = clp,

Lets look at this function

int nfs4_proc_create_session(struct nfs_client *clp, const struct cred *cred)
{
	int status;
	unsigned *ptr;
	struct nfs4_session *session = clp->cl_session;
	struct nfs4_add_xprt_data xprtdata = {
		.clp = clp,
	};
	struct rpc_add_xprt_test rpcdata = {
		.add_xprt_test = clp->cl_mvops->session_trunk,
		.data = &xprtdata,
	};

	dprintk("--> %s clp=%p session=%p\n", __func__, clp, session);

	status = _nfs4_proc_create_session(clp, cred);
	if (status)
		goto out;

	/* Init or reset the session slot tables */
	status = nfs4_setup_session_slot_tables(session);
	dprintk("slot table setup returned %d\n", status);
	if (status)
		goto out;

	ptr = (unsigned *)&session->sess_id.data[0];
	dprintk("%s client>seqid %d sessionid %u:%u:%u:%u\n", __func__,
		clp->cl_seqid, ptr[0], ptr[1], ptr[2], ptr[3]);
	rpc_clnt_probe_trunked_xprts(clp->cl_rpcclient, &rpcdata);
out:
	return status;
}

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?

	Andrew


  reply	other threads:[~2026-02-16 20:06 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-16 17:49 [PATCH v2 0/2] Fix warnings for RISC-V builds Sean Chang
2026-02-16 17:49 ` [PATCH v2 1/2] nfs: fix unused variable warnings Sean Chang
2026-02-16 20:06   ` Andrew Lunn [this message]
2026-02-17  9:55     ` Sean
2026-02-16 17:49 ` [PATCH v2 2/2] net: macb: fix format-truncation warning Sean Chang
2026-02-16 18:35   ` Andrew Lunn
2026-02-17 17:28     ` Sean Chang
2026-02-17 17:46       ` Andrew Lunn
2026-02-17 19:14         ` Sean Chang
2026-02-17 20:33           ` Andrew Lunn
2026-02-18 12:16             ` Sean Chang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2e3bf4db-cea6-4f55-a82b-4e99bb3f44fe@lunn.ch \
    --to=andrew@lunn.ch \
    --cc=anna@kernel.org \
    --cc=claudiu.beznea@tuxon.dev \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-nfs@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=nicolas.ferre@microchip.com \
    --cc=seanwascoding@gmail.com \
    --cc=trond.myklebust@hammerspace.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox