All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tom Rix <trix@redhat.com>
To: ericvh@gmail.com, lucho@ionkov.net, asmadeus@codewreck.org,
	linux_oss@crudebyte.com
Cc: v9fs-developer@lists.sourceforge.net,
	linux-kernel@vger.kernel.org, Tom Rix <trix@redhat.com>
Subject: [PATCH] 9p: remove shadow variable retval in v9fs_dir_release()
Date: Sat, 28 Jan 2023 07:25:49 -0800	[thread overview]
Message-ID: <20230128152549.1241870-1-trix@redhat.com> (raw)

cppcheck reports
fs/9p/vfs_dir.c:219:8: style: Local variable 'retval' shadows outer variable [shadowVariable]
   int retval = file_write_and_wait_range(filp, 0, -1);
       ^

Having another retval decl is not needed, if the initialized 0 is overwritten by a non 0
value by the call to file_write_and_wait_ranget(), the function returns early.

Fixes: b67c64fb0143 ("fs/9p: Consolidate file operations and add readahead and writeback")
Signed-off-by: Tom Rix <trix@redhat.com>
---
 fs/9p/vfs_dir.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/9p/vfs_dir.c b/fs/9p/vfs_dir.c
index 1fc07bb86e6f..a5783afdf31a 100644
--- a/fs/9p/vfs_dir.c
+++ b/fs/9p/vfs_dir.c
@@ -216,7 +216,7 @@ int v9fs_dir_release(struct inode *inode, struct file *filp)
 		 inode, filp, fid ? fid->fid : -1);
 	if (fid) {
 		if ((fid->qid.type == P9_QTFILE) && (filp->f_mode & FMODE_WRITE)) {
-			int retval = file_write_and_wait_range(filp, 0, -1);
+			retval = file_write_and_wait_range(filp, 0, -1);
 
 			if (retval != 0) {
 				p9_debug(P9_DEBUG_ERROR,
-- 
2.26.3


                 reply	other threads:[~2023-01-28 15:26 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20230128152549.1241870-1-trix@redhat.com \
    --to=trix@redhat.com \
    --cc=asmadeus@codewreck.org \
    --cc=ericvh@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux_oss@crudebyte.com \
    --cc=lucho@ionkov.net \
    --cc=v9fs-developer@lists.sourceforge.net \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.