Skip to contentSkip to conversation

Btrfs: tests: checking for NULL instead of IS_ERR()

PATCH In review Dan Carpenter 2 participants 2 messages Nov 10, 2015

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Btrfs: tests: checking for NULL instead of IS_ERR()

btrfs_alloc_dummy_root() return an error pointer on failure, it never returns NULL.

fs/btrfs/tests/free-space-tests.c +3 -1
index c8c3d70..8b72b00 100644
@@ -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)