]> git.baikalelectronics.ru Git - kernel.git/commitdiff
btrfs: simplify return values in btrfs_check_raid_min_devices
authorAnand Jain <anand.jain@oracle.com>
Tue, 27 Jul 2021 23:03:05 +0000 (07:03 +0800)
committerDavid Sterba <dsterba@suse.com>
Mon, 23 Aug 2021 11:19:09 +0000 (13:19 +0200)
Function btrfs_check_raid_min_devices() returns error code from the enum
btrfs_err_code and it starts from 1. So there is no need to check if ret
is > 0. So drop this check and also drop the local variable ret.

Signed-off-by: Anand Jain <anand.jain@oracle.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/volumes.c

index 8526cc39faa97f1a02861f60f2574651f253f9a3..230192d097c427a7f5b3064478ac9f39baf4b65e 100644 (file)
@@ -1949,12 +1949,8 @@ static int btrfs_check_raid_min_devices(struct btrfs_fs_info *fs_info,
                if (!(all_avail & btrfs_raid_array[i].bg_flag))
                        continue;
 
-               if (num_devices < btrfs_raid_array[i].devs_min) {
-                       int ret = btrfs_raid_array[i].mindev_error;
-
-                       if (ret)
-                               return ret;
-               }
+               if (num_devices < btrfs_raid_array[i].devs_min)
+                       return btrfs_raid_array[i].mindev_error;
        }
 
        return 0;