Skip to contentSkip to conversation

fuse: remove dead code in fuse_lookup_name()

PATCH In review Dan Carpenter 1 participant 2 messages Aug 12, 2015

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 fuse: remove dead code in fuse_lookup_name()

We check "outarg->nodeid" twice in a row and it causes a static checker warning. We should return success if "outarg->nodeid" is zero so the first check is correct and the second one should be deleted.

---
v2: The first version of this patch introduced a bug into working code.

    (returning error instead of success).  Sorry.  :(
fs/fuse/dir.c +2 -3
index 5e2e087..56a3463 100644
@@ -306,11 +306,10 @@ int fuse_lookup_name(struct super_block *sb, u64 nodeid, struct qstr *name,
 
 	fuse_lookup_init(fc, &args, nodeid, name, outarg);
 	err = fuse_simple_request(fc, &args);
-	/* Zero nodeid is same as -ENOENT, but with valid timeout */
-	if (err || !outarg->nodeid)
+	if (err)
 		goto out_put_forget;
 
-	err = -EIO;
+	/* Zero nodeid is same as -ENOENT, but with valid timeout */
 	if (!outarg->nodeid)
 		goto out_put_forget;
 	if (!fuse_valid_type(outarg->attr.mode))
#1 lore raw

Oh... Crap. I suck. Sorry, ignore this patch. It's buggy as well.

I'm so really really sorry.

regards,
dan carpenter

Quoted 27 lines · Dan Carpenter

We check "outarg->nodeid" twice in a row and it causes a static checker warning. We should return success if "outarg->nodeid" is zero so the first check is correct and the second one should be deleted.

---
v2: The first version of this patch introduced a bug into working code.

    (returning error instead of success).  Sorry.  :(
fs/fuse/dir.c +2 -3
index 5e2e087..56a3463 100644
@@ -306,11 +306,10 @@ int fuse_lookup_name(struct super_block *sb, u64 nodeid, struct qstr *name,
 
 	fuse_lookup_init(fc, &args, nodeid, name, outarg);
 	err = fuse_simple_request(fc, &args);
-	/* Zero nodeid is same as -ENOENT, but with valid timeout */
-	if (err || !outarg->nodeid)
+	if (err)
 		goto out_put_forget;
 
-	err = -EIO;
+	/* Zero nodeid is same as -ENOENT, but with valid timeout */
 	if (!outarg->nodeid)
 		goto out_put_forget;
 	if (!fuse_valid_type(outarg->attr.mode))