All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] btrfs: Remove redundant initialization of slot
@ 2021-12-31 12:23 Jiapeng Chong
  2021-12-31 13:07 ` Qu Wenruo
  0 siblings, 1 reply; 3+ messages in thread
From: Jiapeng Chong @ 2021-12-31 12:23 UTC (permalink / raw)
  To: clm; +Cc: josef, dsterba, linux-btrfs, linux-kernel, Jiapeng Chong, Abaci Robot

slot is being initialized to path->slots[0] but this is never
read as slot is overwritten later on. Remove the redundant
initialization.

Cleans up the following clang-analyzer warning:

fs/btrfs/tree-log.c:6125:7: warning: Value stored to 'slot' during its
initialization is never read [clang-analyzer-deadcode.DeadStores].

Reported-by: Abaci Robot <abaci@linux.alibaba.com>
Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>
---
 fs/btrfs/tree-log.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c
index 9165486b554e..c083562a3334 100644
--- a/fs/btrfs/tree-log.c
+++ b/fs/btrfs/tree-log.c
@@ -6122,7 +6122,7 @@ static int log_new_ancestors(struct btrfs_trans_handle *trans,
 	while (true) {
 		struct btrfs_fs_info *fs_info = root->fs_info;
 		struct extent_buffer *leaf = path->nodes[0];
-		int slot = path->slots[0];
+		int slot;
 		struct btrfs_key search_key;
 		struct inode *inode;
 		u64 ino;
-- 
2.20.1.7.g153144c


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

* Re: [PATCH] btrfs: Remove redundant initialization of slot
  2021-12-31 12:23 [PATCH] btrfs: Remove redundant initialization of slot Jiapeng Chong
@ 2021-12-31 13:07 ` Qu Wenruo
  2022-01-03 18:21   ` David Sterba
  0 siblings, 1 reply; 3+ messages in thread
From: Qu Wenruo @ 2021-12-31 13:07 UTC (permalink / raw)
  To: Jiapeng Chong, clm; +Cc: josef, dsterba, linux-btrfs, linux-kernel, Abaci Robot



On 2021/12/31 20:23, Jiapeng Chong wrote:
> slot is being initialized to path->slots[0] but this is never
> read as slot is overwritten later on. Remove the redundant
> initialization.
>
> Cleans up the following clang-analyzer warning:
>
> fs/btrfs/tree-log.c:6125:7: warning: Value stored to 'slot' during its
> initialization is never read [clang-analyzer-deadcode.DeadStores].
>
> Reported-by: Abaci Robot <abaci@linux.alibaba.com>
> Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>
> ---
>   fs/btrfs/tree-log.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c
> index 9165486b554e..c083562a3334 100644
> --- a/fs/btrfs/tree-log.c
> +++ b/fs/btrfs/tree-log.c
> @@ -6122,7 +6122,7 @@ static int log_new_ancestors(struct btrfs_trans_handle *trans,
>   	while (true) {
>   		struct btrfs_fs_info *fs_info = root->fs_info;
>   		struct extent_buffer *leaf = path->nodes[0];
> -		int slot = path->slots[0];
> +		int slot;

If you're cleaning up slot, then why not also cleaning up leaf?

And again, no feedback no matter what on other patches from you, and
still CC to maintainers.


>   		struct btrfs_key search_key;
>   		struct inode *inode;
>   		u64 ino;

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

* Re: [PATCH] btrfs: Remove redundant initialization of slot
  2021-12-31 13:07 ` Qu Wenruo
@ 2022-01-03 18:21   ` David Sterba
  0 siblings, 0 replies; 3+ messages in thread
From: David Sterba @ 2022-01-03 18:21 UTC (permalink / raw)
  To: Qu Wenruo
  Cc: Jiapeng Chong, clm, josef, dsterba, linux-btrfs, linux-kernel,
	Abaci Robot

On Fri, Dec 31, 2021 at 09:07:45PM +0800, Qu Wenruo wrote:
> 
> 
> On 2021/12/31 20:23, Jiapeng Chong wrote:
> > slot is being initialized to path->slots[0] but this is never
> > read as slot is overwritten later on. Remove the redundant
> > initialization.
> >
> > Cleans up the following clang-analyzer warning:
> >
> > fs/btrfs/tree-log.c:6125:7: warning: Value stored to 'slot' during its
> > initialization is never read [clang-analyzer-deadcode.DeadStores].
> >
> > Reported-by: Abaci Robot <abaci@linux.alibaba.com>
> > Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>
> > ---
> >   fs/btrfs/tree-log.c | 2 +-
> >   1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c
> > index 9165486b554e..c083562a3334 100644
> > --- a/fs/btrfs/tree-log.c
> > +++ b/fs/btrfs/tree-log.c
> > @@ -6122,7 +6122,7 @@ static int log_new_ancestors(struct btrfs_trans_handle *trans,
> >   	while (true) {
> >   		struct btrfs_fs_info *fs_info = root->fs_info;
> >   		struct extent_buffer *leaf = path->nodes[0];
> > -		int slot = path->slots[0];
> > +		int slot;
> 
> If you're cleaning up slot, then why not also cleaning up leaf?

Yes, the variable leaf does not need to be initialized as well, both
should be cleaned up in the same patch.

> And again, no feedback no matter what on other patches from you, and
> still CC to maintainers.

It's better to add the CCs than not, don't worry about that.

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

end of thread, other threads:[~2022-01-03 18:22 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-31 12:23 [PATCH] btrfs: Remove redundant initialization of slot Jiapeng Chong
2021-12-31 13:07 ` Qu Wenruo
2022-01-03 18:21   ` David Sterba

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.