[PATCH] fuse: drop redundant err assignments in fuse_dev_do_write()

Li Wang <[email protected]> Wed, 8 Jul 2026 10:17:05 +0800
Newsgroups dev.linux.lists.fuse-devel,org.kernel.vger.linux-fsdevel,org.kernel.vger.linux-kernel
Message-ID <[email protected]>
After fuse_copy_one() succeeds, err is set to -EINVAL before validating
oh.len. When oh.len equals nbytes, err is already -EINVAL, so the extra
assignments before the notification and oh.error checks are redundant.

Signed-off-by: Li Wang <[email protected]>
---
 fs/fuse/dev.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c
index 5763a7cd3b37..7813f6214d0e 100644
--- a/fs/fuse/dev.c
+++ b/fs/fuse/dev.c
@@ -1887,7 +1887,6 @@ static ssize_t fuse_dev_do_write(struct fuse_dev *fud,
 		 * Only allow notifications during while the connection is in an
 		 * initialized and connected state
 		 */
-		err = -EINVAL;
 		if (!fch->initialized || !fch->connected)
 			goto copy_finish;
 
@@ -1898,7 +1897,6 @@ static ssize_t fuse_dev_do_write(struct fuse_dev *fud,
 		goto copy_finish;
 	}
 
-	err = -EINVAL;
 	if (oh.error <= -512 || oh.error > 0)
 		goto copy_finish;
 
-- 
2.34.1