Re: [PATCH] btrfs: tests: Fix an NULL vs IS_ERR() test

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On 17.01.20 г. 7:34 ч., Dan Carpenter wrote:
> 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>

Doh...

Reviewed-by: Nikolay Borisov <nborisov@xxxxxxxx>



> ---
>  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;
> 



[Index of Archives]     [Kernel Development]     [Kernel Announce]     [Kernel Newbies]     [Linux Networking Development]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Device Mapper]

  Powered by Linux