2022-04-05 00:47:09

by CGEL

[permalink] [raw]
Subject: [PATCH] fs/buffer.c: remove unneeded code

From: Lv Ruyi <[email protected]>

fix clang warning: Value stored to 'err' is never read in line 2944.

Reported-by: Zeal Robot <[email protected]>
Signed-off-by: Lv Ruyi <[email protected]>
---
fs/buffer.c | 1 -
1 file changed, 1 deletion(-)

diff --git a/fs/buffer.c b/fs/buffer.c
index bfc566de36e5..b2045871e81c 100644
--- a/fs/buffer.c
+++ b/fs/buffer.c
@@ -2941,7 +2941,6 @@ int block_truncate_page(struct address_space *mapping,
pos += blocksize;
}

- err = 0;
if (!buffer_mapped(bh)) {
WARN_ON(bh->b_size != blocksize);
err = get_block(inode, iblock, bh, 0);
--
2.25.1


2022-04-05 00:59:56

by Nick Desaulniers

[permalink] [raw]
Subject: Re: [PATCH] fs/buffer.c: remove unneeded code

On Sat, Apr 2, 2022 at 1:47 AM <[email protected]> wrote:
>
> From: Lv Ruyi <[email protected]>
>
> fix clang warning: Value stored to 'err' is never read in line 2944.
>
> Reported-by: Zeal Robot <[email protected]>
> Signed-off-by: Lv Ruyi <[email protected]>

The change LGTM, but next time please consider putting the exact text
of the warning observed in the commit message. For instance, it's not
clear to me whether this was a compiler warning via -W flag, or a
DeadStore warning from clang-tidy.

Reviewed-by: Nick Desaulniers <[email protected]>

> ---
> fs/buffer.c | 1 -
> 1 file changed, 1 deletion(-)
>
> diff --git a/fs/buffer.c b/fs/buffer.c
> index bfc566de36e5..b2045871e81c 100644
> --- a/fs/buffer.c
> +++ b/fs/buffer.c
> @@ -2941,7 +2941,6 @@ int block_truncate_page(struct address_space *mapping,
> pos += blocksize;
> }
>
> - err = 0;
> if (!buffer_mapped(bh)) {
> WARN_ON(bh->b_size != blocksize);
> err = get_block(inode, iblock, bh, 0);
> --
> 2.25.1
>


--
Thanks,
~Nick Desaulniers

2022-04-05 01:46:52

by Chaitanya Kulkarni

[permalink] [raw]
Subject: Re: [PATCH] fs/buffer.c: remove unneeded code

On 4/2/22 01:47, [email protected] wrote:
> From: Lv Ruyi <[email protected]>
>
> fix clang warning: Value stored to 'err' is never read in line 2944.
>
> Reported-by: Zeal Robot <[email protected]>
> Signed-off-by: Lv Ruyi <[email protected]>


Looks good.

Reviewed-by: Chaitanya Kulkarni <[email protected]>

-ck