btrfs: return -ENOMEM on allocation failure in btrfsic
authorAllen Pais <allen.lkml@gmail.com>
Wed, 20 Sep 2017 06:17:46 +0000 (11:47 +0530)
committerDavid Sterba <dsterba@suse.com>
Mon, 30 Oct 2017 11:27:57 +0000 (12:27 +0100)
Forward the correct return value -ENOMEM from btrfsic_dev_state_alloc()
too.

Signed-off-by: Allen Pais <allen.lkml@gmail.com>
Reviewed-by: Anand Jain <anand.jain@oracle.com>
Reviewed-by: David Sterba <dsterba@suse.com>
[ adjust changelog ]
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/check-integrity.c

index 7d5a9b5..9db1e76 100644 (file)
@@ -2913,7 +2913,7 @@ int btrfsic_mount(struct btrfs_fs_info *fs_info,
        state = kvzalloc(sizeof(*state), GFP_KERNEL);
        if (!state) {
                pr_info("btrfs check-integrity: allocation failed!\n");
-               return -1;
+               return -ENOMEM;
        }
 
        if (!btrfsic_is_initialized) {
@@ -2945,7 +2945,7 @@ int btrfsic_mount(struct btrfs_fs_info *fs_info,
                if (NULL == ds) {
                        pr_info("btrfs check-integrity: kmalloc() failed!\n");
                        mutex_unlock(&btrfsic_mutex);
-                       return -1;
+                       return -ENOMEM;
                }
                ds->bdev = device->bdev;
                ds->state = state;