The btrfs_alloc_dummy_device() function never returns NULL, it returns error pointers. Fixes: 5d9a4f871168 ("btrfs: Add self-tests for btrfs_rmap_block") Signed-off-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx> --- fs/btrfs/tests/extent-map-tests.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/btrfs/tests/extent-map-tests.c b/fs/btrfs/tests/extent-map-tests.c index b7f2c4398e92..70a2f0dc9a78 100644 --- a/fs/btrfs/tests/extent-map-tests.c +++ b/fs/btrfs/tests/extent-map-tests.c @@ -490,9 +490,9 @@ static int test_rmap_block(struct btrfs_fs_info *fs_info, for (i = 0; i < map->num_stripes; i++) { struct btrfs_device *dev = btrfs_alloc_dummy_device(fs_info); - if (!dev) { + if (IS_ERR(dev)) { test_err("cannot allocate device"); - ret = -ENOMEM; + ret = PTR_ERR(dev); goto out; } map->stripes[i].dev = dev; -- 2.11.0