Skip to content

Commit

Permalink
hpfs: remove unnecessary checks on the value of r when assigning erro…
Browse files Browse the repository at this point in the history
…r code

At the point where r is being checked for different values, r is always
going to be equal to 2 as the previous if statements jump to end or end1
if r is not 2.  Hence the assignment to err can be simplified to just
err an assignment without any checks on the value or r.

Detected by CoverityScan, CID#1226737 ("Logically dead code")

Signed-off-by: Colin Ian King <[email protected]>
Reviewed-by: Mikulas Patocka <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
Colin Ian King authored and torvalds committed Aug 25, 2018
1 parent 7634ccd commit e0fcfe1
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion fs/hpfs/namei.c
Original file line number Diff line number Diff line change
Expand Up @@ -565,7 +565,7 @@ static int hpfs_rename(struct inode *old_dir, struct dentry *old_dentry,
err = -EFSERROR;
goto end1;
}
err = r == 2 ? -ENOSPC : r == 1 ? -EFSERROR : 0;
err = -ENOSPC;
goto end1;
}

Expand Down

0 comments on commit e0fcfe1

Please sign in to comment.