linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/1] btrfs: fix improper return value
@ 2016-12-04  4:51 Pan Bian
  2016-12-04 19:57 ` Omar Sandoval
  0 siblings, 1 reply; 5+ messages in thread
From: Pan Bian @ 2016-12-04  4:51 UTC (permalink / raw)
  To: Omar Sandoval, Chris Mason, Josef Bacik, David Sterba, linux-btrfs
  Cc: linux-kernel, Pan Bian

In function btrfs_uuid_tree_iterate(), errno is assigned to variable ret
on errors. However, it directly returns 0. It may be better to return
ret. This patch also removes the warning, because the caller already
prints a warning.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=188731
Signed-off-by: Pan Bian <bianpan2016@163.com>
---
 fs/btrfs/uuid-tree.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/fs/btrfs/uuid-tree.c b/fs/btrfs/uuid-tree.c
index 7fc89e4..83bb2f2 100644
--- a/fs/btrfs/uuid-tree.c
+++ b/fs/btrfs/uuid-tree.c
@@ -351,7 +351,5 @@ int btrfs_uuid_tree_iterate(struct btrfs_fs_info *fs_info,
 
 out:
 	btrfs_free_path(path);
-	if (ret)
-		btrfs_warn(fs_info, "btrfs_uuid_tree_iterate failed %d", ret);
-	return 0;
+	return ret;
 }
-- 
1.9.1

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

* Re: [PATCH 1/1] btrfs: fix improper return value
  2016-12-04  4:51 [PATCH 1/1] btrfs: fix improper return value Pan Bian
@ 2016-12-04 19:57 ` Omar Sandoval
  2016-12-12 13:38   ` David Sterba
  0 siblings, 1 reply; 5+ messages in thread
From: Omar Sandoval @ 2016-12-04 19:57 UTC (permalink / raw)
  To: Pan Bian
  Cc: Chris Mason, Josef Bacik, David Sterba, linux-btrfs, linux-kernel

On Sun, Dec 04, 2016 at 12:51:53PM +0800, Pan Bian wrote:
> In function btrfs_uuid_tree_iterate(), errno is assigned to variable ret
> on errors. However, it directly returns 0. It may be better to return
> ret. This patch also removes the warning, because the caller already
> prints a warning.
> 
> Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=188731

Looks good.

Reviewed-by: Omar Sandoval <osandov@fb.com>

> Signed-off-by: Pan Bian <bianpan2016@163.com>
> ---
>  fs/btrfs/uuid-tree.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/fs/btrfs/uuid-tree.c b/fs/btrfs/uuid-tree.c
> index 7fc89e4..83bb2f2 100644
> --- a/fs/btrfs/uuid-tree.c
> +++ b/fs/btrfs/uuid-tree.c
> @@ -351,7 +351,5 @@ int btrfs_uuid_tree_iterate(struct btrfs_fs_info *fs_info,
>  
>  out:
>  	btrfs_free_path(path);
> -	if (ret)
> -		btrfs_warn(fs_info, "btrfs_uuid_tree_iterate failed %d", ret);
> -	return 0;
> +	return ret;
>  }
> -- 
> 1.9.1
> 
> 

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

* Re: [PATCH 1/1] btrfs: fix improper return value
  2016-12-04 19:57 ` Omar Sandoval
@ 2016-12-12 13:38   ` David Sterba
  0 siblings, 0 replies; 5+ messages in thread
From: David Sterba @ 2016-12-12 13:38 UTC (permalink / raw)
  To: Omar Sandoval
  Cc: Pan Bian, Chris Mason, Josef Bacik, David Sterba, linux-btrfs,
	linux-kernel

On Sun, Dec 04, 2016 at 11:57:07AM -0800, Omar Sandoval wrote:
> On Sun, Dec 04, 2016 at 12:51:53PM +0800, Pan Bian wrote:
> > In function btrfs_uuid_tree_iterate(), errno is assigned to variable ret
> > on errors. However, it directly returns 0. It may be better to return
> > ret. This patch also removes the warning, because the caller already
> > prints a warning.
> > 
> > Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=188731
> 
> Looks good.
> 
> Reviewed-by: Omar Sandoval <osandov@fb.com>

Added to 4.10 queue.

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

* Re: [PATCH 1/1] btrfs: fix improper return value
  2016-12-03 10:55 Pan Bian
@ 2016-12-03 18:45 ` Omar Sandoval
  0 siblings, 0 replies; 5+ messages in thread
From: Omar Sandoval @ 2016-12-03 18:45 UTC (permalink / raw)
  To: Pan Bian
  Cc: Chris Mason, Josef Bacik, David Sterba, linux-btrfs, linux-kernel

On Sat, Dec 03, 2016 at 06:55:16PM +0800, Pan Bian wrote:
> In function btrfs_uuid_tree_iterate(), errno is assigned to variable
> ret on errors. However, it directly returns 0. It may be better to
> return ret.
> 
> Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=188731
> 
> Signed-off-by: Pan Bian <bianpan2016@163.com>
> ---
>  fs/btrfs/uuid-tree.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fs/btrfs/uuid-tree.c b/fs/btrfs/uuid-tree.c
> index 7fc89e4..44bcc1f 100644
> --- a/fs/btrfs/uuid-tree.c
> +++ b/fs/btrfs/uuid-tree.c
> @@ -353,5 +353,5 @@ int btrfs_uuid_tree_iterate(struct btrfs_fs_info *fs_info,
>  	btrfs_free_path(path);
>  	if (ret)
>  		btrfs_warn(fs_info, "btrfs_uuid_tree_iterate failed %d", ret);
> -	return 0;
> +	return ret;

This one makes sense, since the caller is checking the return value. The
caller is already printing a warning, can you also get rid of the
btrfs_warn(fs_info, "btrfs_uuid_tree_iterate failed %d", ret)?

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

* [PATCH 1/1] btrfs: fix improper return value
@ 2016-12-03 10:55 Pan Bian
  2016-12-03 18:45 ` Omar Sandoval
  0 siblings, 1 reply; 5+ messages in thread
From: Pan Bian @ 2016-12-03 10:55 UTC (permalink / raw)
  To: Chris Mason, Josef Bacik, David Sterba, linux-btrfs
  Cc: linux-kernel, Pan Bian

In function btrfs_uuid_tree_iterate(), errno is assigned to variable
ret on errors. However, it directly returns 0. It may be better to
return ret.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=188731

Signed-off-by: Pan Bian <bianpan2016@163.com>
---
 fs/btrfs/uuid-tree.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/btrfs/uuid-tree.c b/fs/btrfs/uuid-tree.c
index 7fc89e4..44bcc1f 100644
--- a/fs/btrfs/uuid-tree.c
+++ b/fs/btrfs/uuid-tree.c
@@ -353,5 +353,5 @@ int btrfs_uuid_tree_iterate(struct btrfs_fs_info *fs_info,
 	btrfs_free_path(path);
 	if (ret)
 		btrfs_warn(fs_info, "btrfs_uuid_tree_iterate failed %d", ret);
-	return 0;
+	return ret;
 }
-- 
1.9.1

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

end of thread, other threads:[~2016-12-12 13:38 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-12-04  4:51 [PATCH 1/1] btrfs: fix improper return value Pan Bian
2016-12-04 19:57 ` Omar Sandoval
2016-12-12 13:38   ` David Sterba
  -- strict thread matches above, loose matches on Subject: below --
2016-12-03 10:55 Pan Bian
2016-12-03 18:45 ` Omar Sandoval

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).