linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] btrfs: tests: Fix an NULL vs IS_ERR() test
@ 2020-01-17  5:34 Dan Carpenter
  2020-01-17  7:11 ` Nikolay Borisov
  2020-01-17 13:55 ` David Sterba
  0 siblings, 2 replies; 3+ messages in thread
From: Dan Carpenter @ 2020-01-17  5:34 UTC (permalink / raw)
  To: Chris Mason, Nikolay Borisov
  Cc: Josef Bacik, David Sterba, linux-btrfs, kernel-janitors

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@oracle.com>
---
 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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] btrfs: tests: Fix an NULL vs IS_ERR() test
  2020-01-17  5:34 [PATCH] btrfs: tests: Fix an NULL vs IS_ERR() test Dan Carpenter
@ 2020-01-17  7:11 ` Nikolay Borisov
  2020-01-17 13:55 ` David Sterba
  1 sibling, 0 replies; 3+ messages in thread
From: Nikolay Borisov @ 2020-01-17  7:11 UTC (permalink / raw)
  To: Dan Carpenter, Chris Mason
  Cc: Josef Bacik, David Sterba, linux-btrfs, kernel-janitors



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@oracle.com>

Doh...

Reviewed-by: Nikolay Borisov <nborisov@suse.com>



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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] btrfs: tests: Fix an NULL vs IS_ERR() test
  2020-01-17  5:34 [PATCH] btrfs: tests: Fix an NULL vs IS_ERR() test Dan Carpenter
  2020-01-17  7:11 ` Nikolay Borisov
@ 2020-01-17 13:55 ` David Sterba
  1 sibling, 0 replies; 3+ messages in thread
From: David Sterba @ 2020-01-17 13:55 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Chris Mason, Nikolay Borisov, Josef Bacik, David Sterba,
	linux-btrfs, kernel-janitors

On Fri, Jan 17, 2020 at 08:34:32AM +0300, 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@oracle.com>

Thanks, folded to the original patch.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-01-17 13:55 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-17  5:34 [PATCH] btrfs: tests: Fix an NULL vs IS_ERR() test Dan Carpenter
2020-01-17  7:11 ` Nikolay Borisov
2020-01-17 13:55 ` David Sterba

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).