public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] btrfs: remove unneeded variable from unpin_extent_cache()
       [not found] <20230614065736.22353-1-luojianhong@cdjrlc.com>
@ 2023-06-14  6:59 ` baomingtong001
  2023-06-14  7:03   ` Christoph Hellwig
  2023-06-14  7:09   ` Qu Wenruo
  0 siblings, 2 replies; 3+ messages in thread
From: baomingtong001 @ 2023-06-14  6:59 UTC (permalink / raw)
  To: clm, josef, dsterba; +Cc: linux-btrfs, linux-kernel

fix the following coccicheck warning:

fs/btrfs/extent_map.c:298:5-8: Unneeded variable: "ret". Return "0".

Signed-off-by: Mingtong Bao <baomingtong001@208suo.com>
---
  fs/btrfs/extent_map.c | 3 +--
  1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/fs/btrfs/extent_map.c b/fs/btrfs/extent_map.c
index 0cdb3e86f29b..f3e9aaeb9956 100644
--- a/fs/btrfs/extent_map.c
+++ b/fs/btrfs/extent_map.c
@@ -295,7 +295,6 @@ static void try_merge_map(struct extent_map_tree 
*tree, struct extent_map *em)
  int unpin_extent_cache(struct extent_map_tree *tree, u64 start, u64 
len,
                 u64 gen)
  {
-    int ret = 0;
      struct extent_map *em;
      bool prealloc = false;

@@ -327,7 +326,7 @@ int unpin_extent_cache(struct extent_map_tree *tree, 
u64 start, u64 len,
      free_extent_map(em);
  out:
      write_unlock(&tree->lock);
-    return ret;
+    return 0;

  }

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

* Re: [PATCH] btrfs: remove unneeded variable from unpin_extent_cache()
  2023-06-14  6:59 ` [PATCH] btrfs: remove unneeded variable from unpin_extent_cache() baomingtong001
@ 2023-06-14  7:03   ` Christoph Hellwig
  2023-06-14  7:09   ` Qu Wenruo
  1 sibling, 0 replies; 3+ messages in thread
From: Christoph Hellwig @ 2023-06-14  7:03 UTC (permalink / raw)
  To: baomingtong001; +Cc: clm, josef, dsterba, linux-btrfs, linux-kernel

Looks good:

Reviewed-by: Christoph Hellwig <hch@lst.de>

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

* Re: [PATCH] btrfs: remove unneeded variable from unpin_extent_cache()
  2023-06-14  6:59 ` [PATCH] btrfs: remove unneeded variable from unpin_extent_cache() baomingtong001
  2023-06-14  7:03   ` Christoph Hellwig
@ 2023-06-14  7:09   ` Qu Wenruo
  1 sibling, 0 replies; 3+ messages in thread
From: Qu Wenruo @ 2023-06-14  7:09 UTC (permalink / raw)
  To: baomingtong001, clm, josef, dsterba; +Cc: linux-btrfs, linux-kernel



On 2023/6/14 14:59, baomingtong001@208suo.com wrote:
> fix the following coccicheck warning:
>
> fs/btrfs/extent_map.c:298:5-8: Unneeded variable: "ret". Return "0".
>
> Signed-off-by: Mingtong Bao <baomingtong001@208suo.com>

You can take it one step further by making the function return void.

Thanks,
Qu
> ---
>   fs/btrfs/extent_map.c | 3 +--
>   1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/fs/btrfs/extent_map.c b/fs/btrfs/extent_map.c
> index 0cdb3e86f29b..f3e9aaeb9956 100644
> --- a/fs/btrfs/extent_map.c
> +++ b/fs/btrfs/extent_map.c
> @@ -295,7 +295,6 @@ static void try_merge_map(struct extent_map_tree
> *tree, struct extent_map *em)
>   int unpin_extent_cache(struct extent_map_tree *tree, u64 start, u64 len,
>                  u64 gen)
>   {
> -    int ret = 0;
>       struct extent_map *em;
>       bool prealloc = false;
>
> @@ -327,7 +326,7 @@ int unpin_extent_cache(struct extent_map_tree *tree,
> u64 start, u64 len,
>       free_extent_map(em);
>   out:
>       write_unlock(&tree->lock);
> -    return ret;
> +    return 0;
>
>   }

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

end of thread, other threads:[~2023-06-14  7:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20230614065736.22353-1-luojianhong@cdjrlc.com>
2023-06-14  6:59 ` [PATCH] btrfs: remove unneeded variable from unpin_extent_cache() baomingtong001
2023-06-14  7:03   ` Christoph Hellwig
2023-06-14  7:09   ` Qu Wenruo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox