diff mbox series

btrfs: Remove logically dead code from btrfs_orphan_cleanup

Message ID 1536827700-20477-1-git-send-email-nborisov@suse.com (mailing list archive)
State New, archived
Headers show
Series btrfs: Remove logically dead code from btrfs_orphan_cleanup | expand

Commit Message

Nikolay Borisov Sept. 13, 2018, 8:35 a.m. UTC
In btrfs_orphan_cleanup the final 'if (ret) goto out' cannot ever be
executed. This is due to the last assignment to 'ret' depending on
the return value of btrfs_iget. If an error other than -ENOENT is
returned then the loop is prematurely terminated by 'goto out'.
On the other hand, if the error value is ENOENT then a subsequent
if branch is executed that always re-assigns 'ret' and in case it's
an error just terminates the loop. No functional changes.

CID: 1437392
Signed-off-by: Nikolay Borisov <nborisov@suse.com>
---
 fs/btrfs/inode.c | 2 --
 1 file changed, 2 deletions(-)

Comments

Lu Fengqi Sept. 13, 2018, 8:42 a.m. UTC | #1
On Thu, Sep 13, 2018 at 11:35:00AM +0300, Nikolay Borisov wrote:
>In btrfs_orphan_cleanup the final 'if (ret) goto out' cannot ever be
>executed. This is due to the last assignment to 'ret' depending on
>the return value of btrfs_iget. If an error other than -ENOENT is
>returned then the loop is prematurely terminated by 'goto out'.
>On the other hand, if the error value is ENOENT then a subsequent
>if branch is executed that always re-assigns 'ret' and in case it's
>an error just terminates the loop. No functional changes.
>
>CID: 1437392
>Signed-off-by: Nikolay Borisov <nborisov@suse.com>

Reviewed-by: Lu Fengqi <lufq.fnst@cn.fujitsu.com>

>---
> fs/btrfs/inode.c | 2 --
> 1 file changed, 2 deletions(-)
>
>diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
>index 3f03fec06a3a..64df0378a22f 100644
>--- a/fs/btrfs/inode.c
>+++ b/fs/btrfs/inode.c
>@@ -3471,8 +3471,6 @@ int btrfs_orphan_cleanup(struct btrfs_root *root)
> 
> 		/* this will do delete_inode and everything for us */
> 		iput(inode);
>-		if (ret)
>-			goto out;
> 	}
> 	/* release the path since we're done with it */
> 	btrfs_release_path(path);
>-- 
>2.7.4
>
>
>
David Sterba Sept. 14, 2018, 1:55 p.m. UTC | #2
On Thu, Sep 13, 2018 at 11:35:00AM +0300, Nikolay Borisov wrote:
> In btrfs_orphan_cleanup the final 'if (ret) goto out' cannot ever be
> executed. This is due to the last assignment to 'ret' depending on
> the return value of btrfs_iget. If an error other than -ENOENT is
> returned then the loop is prematurely terminated by 'goto out'.
> On the other hand, if the error value is ENOENT then a subsequent
> if branch is executed that always re-assigns 'ret' and in case it's
> an error just terminates the loop. No functional changes.
> 
> CID: 1437392
> Signed-off-by: Nikolay Borisov <nborisov@suse.com>

Reviewed-by: David Sterba <dsterba@suse.com>
diff mbox series

Patch

diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 3f03fec06a3a..64df0378a22f 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -3471,8 +3471,6 @@  int btrfs_orphan_cleanup(struct btrfs_root *root)
 
 		/* this will do delete_inode and everything for us */
 		iput(inode);
-		if (ret)
-			goto out;
 	}
 	/* release the path since we're done with it */
 	btrfs_release_path(path);