diff mbox series

[1/3] btrfs: dev stat drop useless goto

Message ID 20190821092634.6778-1-anand.jain@oracle.com (mailing list archive)
State New, archived
Headers show
Series [1/3] btrfs: dev stat drop useless goto | expand

Commit Message

Anand Jain Aug. 21, 2019, 9:26 a.m. UTC
In the function btrfs_init_dev_stats() goto out is not needed, because the
alloc has failed. So just return -ENOMEM.

Signed-off-by: Anand Jain <anand.jain@oracle.com>
---
 fs/btrfs/volumes.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

Comments

David Sterba Aug. 21, 2019, 2:02 p.m. UTC | #1
On Wed, Aug 21, 2019 at 05:26:32PM +0800, Anand Jain wrote:
> In the function btrfs_init_dev_stats() goto out is not needed, because the
> alloc has failed. So just return -ENOMEM.
> 
> Signed-off-by: Anand Jain <anand.jain@oracle.com>

I'll add 1 and 2 to misc-next, 3 seems to be buggy.
diff mbox series

Patch

diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
index 9b684adad81c..bd279db0f760 100644
--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -7289,10 +7289,8 @@  int btrfs_init_dev_stats(struct btrfs_fs_info *fs_info)
 	int i;
 
 	path = btrfs_alloc_path();
-	if (!path) {
-		ret = -ENOMEM;
-		goto out;
-	}
+	if (!path)
+		return -ENOMEM;
 
 	mutex_lock(&fs_devices->device_list_mutex);
 	list_for_each_entry(device, &fs_devices->devices, dev_list) {
@@ -7332,7 +7330,6 @@  int btrfs_init_dev_stats(struct btrfs_fs_info *fs_info)
 	}
 	mutex_unlock(&fs_devices->device_list_mutex);
 
-out:
 	btrfs_free_path(path);
 	return ret < 0 ? ret : 0;
 }