Btrfs: tests: checking for NULL instead of IS_ERR()
authorDan Carpenter <dan.carpenter@oracle.com>
Tue, 10 Nov 2015 09:10:03 +0000 (12:10 +0300)
committerChris Mason <clm@fb.com>
Wed, 25 Nov 2015 13:19:50 +0000 (05:19 -0800)
btrfs_alloc_dummy_root() return an error pointer on failure, it never
returns NULL.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: Chris Mason <clm@fb.com>
fs/btrfs/tests/free-space-tests.c

index c8c3d70c31ffad4e02acd04e0f7dcaa54ad0fe2b..8b72b005bfb9a212518a711a2e476c2d70b47b24 100644 (file)
@@ -898,8 +898,10 @@ int btrfs_test_free_space_cache(void)
        }
 
        root = btrfs_alloc_dummy_root();
-       if (!root)
+       if (IS_ERR(root)) {
+               ret = PTR_ERR(root);
                goto out;
+       }
 
        root->fs_info = btrfs_alloc_dummy_fs_info();
        if (!root->fs_info)