From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pl1-f172.google.com (mail-pl1-f172.google.com [209.85.214.172]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D52B73B2A0 for ; Thu, 11 Dec 2025 09:04:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765443883; cv=none; b=DZkraDjN8icyg78SrlYTE06LNiy+SK86I9qoK1wPQmSP2KyTFMwV4c3VosTc6eFFO02IP0XNqHT8rAmr4MMjy+i3YkgknVZ70OEhbDTy93XBQR+G6kngfi6f2WphSJ8atclmiBOBZODnOInoZmP1JSS8C6FgUGC+YNUlL5mMhbM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765443883; c=relaxed/simple; bh=UCIIXv9G4yVCDOpbXiC6JId9Thqzla0/Ovck4dx+7hw=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=Dx7ggNDIfwMJh93WDOwtVe6u+0xYgW9m7XFdB7+iKQEaKQ95gK0Fgl73qlBbZPO/o2QLA/Wq5d+Q3g+ruOAep4fo21iehbFgmfb82nZvlop53esA8g8sbKyqCBY35F5sQAfzmbwywVshjlpBohnLD63kQmiihkpIG9BqfS6BxTg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=gA/txvVO; arc=none smtp.client-ip=209.85.214.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="gA/txvVO" Received: by mail-pl1-f172.google.com with SMTP id d9443c01a7336-2981f9ce15cso9194205ad.1 for ; Thu, 11 Dec 2025 01:04:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1765443879; x=1766048679; darn=vger.kernel.org; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:from:to :cc:subject:date:message-id:reply-to; bh=5qXNOg66QNlCh/5oLojujcd3gpQl78YkarRtsp6bjLg=; b=gA/txvVO34SoYqggLQlRNIO3a4ZmaHaFam3EObGtKcFZk8CkZlRn3JfhkOGJ9t9Uqs Eb4Bhm9IYeT4ksrJLs3crHePQ9USOu5d6d1IxP6M2GiiZsBxKiofd7OW4PBAWyr8dwg4 FDcSBLh68n2ks+CVG5hLGF42GHWd+6sPuwB8km1ORFKzimEZ+dBaGh274A3GGD5HnUcI OOdW93obJ7vdrTmpjiWUnUY2grqhsQtwABYK4QOSSs2fqcM7O5eGC5t7d5qTb/9a3+Vh 9w494ZOBBdr44i4Tam8UpGQL5k+Mj/IqU/L+v790QM9KHH2WFGejoM3Nu4UfwIripoqB osZQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1765443879; x=1766048679; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=5qXNOg66QNlCh/5oLojujcd3gpQl78YkarRtsp6bjLg=; b=rLgyEpni+AtCVq/SpSxRq95XkxwGh0QBKluD5gvrF6C8OTfzsdGzrKzEVmeee3y8Ll yWjGQ7o5wvXTZUvHIdlpIlEcbL8L4tQDnFYj6BY5Xhb0kxq2LbP+lb5NgMFnAVyNZ1LF s0K0fDYG6bvOBkYqb7nCv2KLg/FVqhJMe73vhR1Ylrfyqq+7s1dON0eha4aCLSGoEBhq N1/AwxA1pL595RJyMqx600L4Tkf9uxXyeEC9NsJtLrPkK3Z5Nba2dxczZWWpEqO9V0c4 B1EvGwijLD397ouzu1lRecXMohYC92kEnVinK5YbTEOcc0jQIhLoE0nNsHjv/WplCTvJ 1Hig== X-Forwarded-Encrypted: i=1; AJvYcCVecenSz/8Fvko+qS5WPi9NQBHbrVnFHwzkc5TvmMLaKeYql0IOMActnJ/4b8592Rop4M3df3SrcIPf0pE=@vger.kernel.org X-Gm-Message-State: AOJu0YykJKIVzaAsOof4jrTi2cg5Xaa/U0ZQY7IhsiaIIEedXH9Fn3oY J54UgFMiun6ZYrHzNjxLT4RMMFrDoQ/c/oSF7gIz94MwYzTxIZHKOQIn X-Gm-Gg: AY/fxX5O+gT+eXK9PFB2hKQWatfVq4yqIdReW73I2NkvQqdKMye8YC2nFUM3+ZdFYTi QmMvXgNK8DcmJMyn+QjxQSrz+p9So3ebOeJKUtJDJwP6ZixGj6sfRFisc2cz1Xp6OhVV17/0Poe TAXaI8JnzaQtC6FCmCMMPnBZjyTQYLLJYupRJkCCPlpJZP1E3hFN7VGUpKYAF/VVzKJh0pPaUZ+ AGojXgkG7nsBAJnba6Ll012pyyv6EqBokn5nnnhMjukABQi80MMtX44Wh755t0gGMOf9HCbEcXj qg+PycUy0moJgtu7wR+F5c4oXwFcyuC62RTHe44ZjOtR6x0k5Im/SgAv5QkwdXLZ6uI7RRPdM7r brWe6GuPi7VJXlFFL5C1SCfAIYwkZ67GYW1iomNvRSNUasZ9OVdZTig1DhS43n4y81Nc8mTK1Ul a8wDKqmwkyPGiTI5l4TQs= X-Google-Smtp-Source: AGHT+IGCIvgH536sa8ZV4DbAJX/s5vEFxJM+ew5WoYn8m0d0rXmMd2jOunltk7ifFr/oYi+OG6pi/g== X-Received: by 2002:a17:902:d4cf:b0:298:29e0:5f32 with SMTP id d9443c01a7336-29ec26b5217mr53020435ad.15.1765443878921; Thu, 11 Dec 2025 01:04:38 -0800 (PST) Received: from google.com ([2401:fa00:95:201:8739:3cdd:8fc7:3115]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-29ee9d36bf5sm17779355ad.24.2025.12.11.01.04.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Dec 2025 01:04:38 -0800 (PST) Date: Thu, 11 Dec 2025 17:04:35 +0800 From: Kuan-Wei Chiu To: Pycode Cc: Jeff Layton , Trond Myklebust , Anna Schumaker , linux-nfs@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] Removed unused variable Message-ID: References: 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=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: On Thu, Dec 11, 2025 at 08:31:57AM +0100, Pycode wrote: > On Thu, Dec 11, 2025 at 02:54:03PM +0800, Kuan-Wei Chiu wrote: > > On Thu, Dec 11, 2025 at 06:57:54AM +0100, Pycode wrote: > > > On Thu, Dec 11, 2025 at 08:10:25AM +0900, Jeff Layton wrote: > > > > A more descriptive title is preferred: "Remove unused variable from > > > > nfs4_ff_alloc_deviceid_node()" > > > > > > > > > > Thanks for the advices! > > > > > > > On Wed, 2025-12-10 at 21:59 +0100, Pycode wrote: > > > > > Signed-off-by: Pycode > > > > > > > > > > Removed the unused variable ret in > > > > > fs/nfs/flexfilelayout/flexfilelayoutdev.c > > > > > > > > > > (Disclaimer this is my first patch, be sorry if I have done anything > > > > > wrong!) > > > > > --- > > > > > fs/nfs/flexfilelayout/flexfilelayoutdev.c | 4 +--- > > > > > 1 file changed, 1 insertion(+), 3 deletions(-) > > > > > > > > > > diff --git a/fs/nfs/flexfilelayout/flexfilelayoutdev.c b/fs/nfs/flexfilelayout/flexfilelayoutdev.c > > > > > index c55ea8fa3bfa..9cd04e85d52f 100644 > > > > > --- a/fs/nfs/flexfilelayout/flexfilelayoutdev.c > > > > > +++ b/fs/nfs/flexfilelayout/flexfilelayoutdev.c > > > > > @@ -53,7 +53,7 @@ nfs4_ff_alloc_deviceid_node(struct nfs_server *server, struct pnfs_device *pdev, > > > > > u32 mp_count; > > > > > u32 version_count; > > > > > __be32 *p; > > > > > - int i, ret = -ENOMEM; > > > > > + int i = -ENOMEM; > > > > > > > > > > > > > No need to initialize this. > > > > > > > > > /* set up xdr stream */ > > > > > scratch = folio_alloc(gfp_flags, 0); > > > > > @@ -88,7 +88,6 @@ nfs4_ff_alloc_deviceid_node(struct nfs_server *server, struct pnfs_device *pdev, > > > > > if (list_empty(&dsaddrs)) { > > > > > dprintk("%s: no suitable DS addresses found\n", > > > > > __func__); > > > > > - ret = -ENOMEDIUM; > > > > > goto out_err_drain_dsaddrs; > > > > > } > > > > > > > > > > @@ -134,7 +133,6 @@ nfs4_ff_alloc_deviceid_node(struct nfs_server *server, struct pnfs_device *pdev, > > > > > dprintk("%s: [%d] unsupported ds version %d-%d\n", __func__, > > > > > i, ds_versions[i].version, > > > > > ds_versions[i].minor_version); > > > > > - ret = -EPROTONOSUPPORT; > > > > > goto out_err_drain_dsaddrs; > > > > > } > > > > > > > > > > > > > What about the dprintk() at the bottom of this function? Does this > > > > actually build? > > > > > > There is no dprintk() at the bottom that used the variable. > > > > At the bottom of this function, there is a dprintk call that refers to ret: > > > > dprintk("%s ERROR: returning %d\n", __func__, ret); > > return NULL; > > > > This causes the build to fail: > > > > In file included from ./include/asm-generic/bug.h:31, > > from ./arch/x86/include/asm/bug.h:193, > > from ./arch/x86/include/asm/alternative.h:9, > > from ./arch/x86/include/asm/barrier.h:5, > > from ./include/asm-generic/bitops/generic-non-atomic.h:7, > > from ./include/linux/bitops.h:28, > > from ./include/linux/kernel.h:23, > > from ./include/linux/uio.h:8, > > from ./include/linux/socket.h:8, > > from ./include/uapi/linux/in.h:25, > > from ./include/linux/in.h:19, > > from ./include/linux/nfs_fs.h:22, > > from fs/nfs/flexfilelayout/flexfilelayoutdev.c:10: > > fs/nfs/flexfilelayout/flexfilelayoutdev.c: In function ‘nfs4_ff_alloc_deviceid_node’: > > fs/nfs/flexfilelayout/flexfilelayoutdev.c:182:55: error: ‘ret’ undeclared (first use in this function); did you mean ‘net’? > > 182 | dprintk("%s ERROR: returning %d\n", __func__, ret); > > | ^~~ > > ./include/linux/printk.h:484:33: note: in definition of macro ‘printk_index_wrap’ > > 484 | _p_func(_fmt, ##__VA_ARGS__); \ > > | ^~~~~~~~~~~ > > ./include/linux/sunrpc/debug.h:36:41: note: in expansion of macro ‘printk’ > > 36 | # define __sunrpc_printk(fmt, ...) printk(KERN_DEFAULT fmt, ##__VA_ARGS__) > > | ^~~~~~ > > ./include/linux/sunrpc/debug.h:42:17: note: in expansion of macro ‘__sunrpc_printk’ > > 42 | __sunrpc_printk(fmt, ##__VA_ARGS__); \ > > | ^~~~~~~~~~~~~~~ > > ./include/linux/sunrpc/debug.h:25:9: note: in expansion of macro ‘dfprintk’ > > 25 | dfprintk(FACILITY, fmt, ##__VA_ARGS__) > > | ^~~~~~~~ > > fs/nfs/flexfilelayout/flexfilelayoutdev.c:182:9: note: in expansion of macro ‘dprintk’ > > 182 | dprintk("%s ERROR: returning %d\n", __func__, ret); > > | ^~~~~~~ > > fs/nfs/flexfilelayout/flexfilelayoutdev.c:182:55: note: each undeclared identifier is reported only once for each function it appears in > > 182 | dprintk("%s ERROR: returning %d\n", __func__, ret); > > | ^~~ > > ./include/linux/printk.h:484:33: note: in definition of macro ‘printk_index_wrap’ > > 484 | _p_func(_fmt, ##__VA_ARGS__); \ > > | ^~~~~~~~~~~ > > ./include/linux/sunrpc/debug.h:36:41: note: in expansion of macro ‘printk’ > > 36 | # define __sunrpc_printk(fmt, ...) printk(KERN_DEFAULT fmt, ##__VA_ARGS__) > > | ^~~~~~ > > ./include/linux/sunrpc/debug.h:42:17: note: in expansion of macro ‘__sunrpc_printk’ > > 42 | __sunrpc_printk(fmt, ##__VA_ARGS__); \ > > | ^~~~~~~~~~~~~~~ > > ./include/linux/sunrpc/debug.h:25:9: note: in expansion of macro ‘dfprintk’ > > 25 | dfprintk(FACILITY, fmt, ##__VA_ARGS__) > > | ^~~~~~~~ > > fs/nfs/flexfilelayout/flexfilelayoutdev.c:182:9: note: in expansion of macro ‘dprintk’ > > 182 | dprintk("%s ERROR: returning %d\n", __func__, ret); > > | ^~~~~~~ > > make[5]: *** [scripts/Makefile.build:287: fs/nfs/flexfilelayout/flexfilelayoutdev.o] Error 1 > > make[4]: *** [scripts/Makefile.build:556: fs/nfs/flexfilelayout] Error 2 > > make[3]: *** [scripts/Makefile.build:556: fs/nfs] Error 2 > > make[2]: *** [scripts/Makefile.build:556: fs] Error 2 > > Sorry, I didn't see that there were more returns because of the jumps. For some reason, it compiled without any problems for me. > > My guess is that this build failure only shows up with the debug config on, which you don't seem to have enabled. Regards, Kuan-Wei