From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from vps0.lunn.ch (vps0.lunn.ch [156.67.10.101]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2741F3A9D8D; Tue, 24 Feb 2026 17:54:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=156.67.10.101 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771955684; cv=none; b=pTZH7618R20J0N3kcrtxt7bdIujqORuZloy6MCAett/IiUcLfEcYUsXvXRcr6QVq7DAb9cwte8CH8STxIv4uz4upAWnlvPz2Rjx/ri87dc9ndX7eRmo+2x/6LN2SEK20pA45kzcqfSMfA5hmFthHGESg+HD1stvYomAEv9LSrK4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771955684; c=relaxed/simple; bh=sRojY1dmgu1SyxAfQQtY2z7zl3cRmyWOWNS/bWU3SAc=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=ZcQV8WhVFq9AaIBmoN0vRIfOYvgrrwLBcu/Hx/1qLExZLuhRaudngHW4whdyP6EIE66K20Jriy5/Fim5+p+SiUa26mKjF6OeVrSaEsnsWiL1w9UjT1MB5Ej1IOUvsJmhckOgZN4FdaQu6FS+7fKq6noM0FajDOD1QerZu2hkP44= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=lunn.ch; spf=pass smtp.mailfrom=lunn.ch; dkim=pass (1024-bit key) header.d=lunn.ch header.i=@lunn.ch header.b=FJx2QJD7; arc=none smtp.client-ip=156.67.10.101 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=lunn.ch Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=lunn.ch Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=lunn.ch header.i=@lunn.ch header.b="FJx2QJD7" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lunn.ch; s=20171124; h=In-Reply-To:Content-Disposition:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:From:Sender:Reply-To:Subject: Date:Message-ID:To:Cc:MIME-Version:Content-Type:Content-Transfer-Encoding: Content-ID:Content-Description:Content-Disposition:In-Reply-To:References; bh=QXigi2nK3SDfHh3A5lurODPTPbH1RaxAQPTqnpmP9o8=; b=FJx2QJD7ypH2/wfmwtUXNWGJ8s FgtvcOhUqzTU+pJbur60tTSCjHqi/SXLaGUFg75X4KtCWcjkXW0zwjuOek2MTFs1HZISfuz8T4Nrq fHtKNOQJZe2QirywIEtz0eZo6usDLMjbOtdVZ9LrlDB/Xi0HNFmyq315djUaQLvUy4bs=; Received: from andrew by vps0.lunn.ch with local (Exim 4.94.2) (envelope-from ) id 1vuwcF-008dan-Ir; Tue, 24 Feb 2026 18:54:35 +0100 Date: Tue, 24 Feb 2026 18:54:35 +0100 From: Andrew Lunn To: Sean Chang 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 v3 1/2] nfs: fix unused variable warning when CONFIG_SUNRPC_DEBUG is disabled Message-ID: <55375148-e26f-4d62-8690-c0eae8bb1b39@lunn.ch> References: <20260224165435.17648-1-seanwascoding@gmail.com> <20260224165435.17648-2-seanwascoding@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20260224165435.17648-2-seanwascoding@gmail.com> On Wed, Feb 25, 2026 at 12:54:34AM +0800, Sean Chang wrote: > When CONFIG_SUNRPC_DEBUG is disabled, the dprintk() macro expands to > an empty do-while loop. This causes variables used solely within > dprintk() calls to appear unused to the compiler, triggering > -Wunused-variable warnings. > > Fix this by adding __maybe_unused to the affected variables. This > ensures the code builds cleanly across different configurations, > including RISC-V, ARM, and ARM64 allmodconfig, as verified in the > mailing list discussion. > > Signed-off-by: Sean Chang > --- > fs/nfs/flexfilelayout/flexfilelayout.c | 2 +- > fs/nfs/flexfilelayout/flexfilelayoutdev.c | 3 ++- > fs/nfs/nfs4proc.c | 2 +- > 3 files changed, 4 insertions(+), 3 deletions(-) > > diff --git a/fs/nfs/flexfilelayout/flexfilelayout.c b/fs/nfs/flexfilelayout/flexfilelayout.c > index 9056f05a67dc..de9e8bad6af2 100644 > --- a/fs/nfs/flexfilelayout/flexfilelayout.c > +++ b/fs/nfs/flexfilelayout/flexfilelayout.c > @@ -1502,7 +1502,7 @@ static void ff_layout_io_track_ds_error(struct pnfs_layout_segment *lseg, > { > struct nfs4_ff_layout_mirror *mirror; > u32 status = *op_status; > - int err; > + int err __maybe_unused; Sorry, but this is ugly. There must be a better way to fix this. Maybe look at no_printk(). https://elixir.bootlin.com/linux/v6.19.3/source/drivers/video/fbdev/core/fbmon.c#L50 #ifdef DEBUG #define DPRINTK(fmt, args...) printk(fmt,## args) #else #define DPRINTK(fmt, args...) no_printk(fmt, ##args) #endif Andrew --- pw-bot: cr