* [PATCH] crypto: xor - Remove unused variable count in do_xor_speed
@ 2020-10-06 19:58 Nathan Chancellor
2020-10-06 21:35 ` Doug Anderson
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Nathan Chancellor @ 2020-10-06 19:58 UTC (permalink / raw)
To: Herbert Xu, David S. Miller, Ard Biesheuvel
Cc: Douglas Anderson, linux-crypto, linux-kernel, clang-built-linux,
Nathan Chancellor
Clang warns:
crypto/xor.c:101:4: warning: variable 'count' is uninitialized when used
here [-Wuninitialized]
count++;
^~~~~
crypto/xor.c:86:17: note: initialize the variable 'count' to silence
this warning
int i, j, count;
^
= 0
1 warning generated.
After the refactoring to use ktime that happened in this function, count
is only assigned, never read. Just remove the variable to get rid of the
warning.
Fixes: c055e3eae0f1 ("crypto: xor - use ktime for template benchmarking")
Link: https://github.com/ClangBuiltLinux/linux/issues/1171
Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
---
crypto/xor.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/crypto/xor.c b/crypto/xor.c
index a0badbc03577..eacbf4f93990 100644
--- a/crypto/xor.c
+++ b/crypto/xor.c
@@ -83,7 +83,7 @@ static void __init
do_xor_speed(struct xor_block_template *tmpl, void *b1, void *b2)
{
int speed;
- int i, j, count;
+ int i, j;
ktime_t min, start, diff;
tmpl->next = template_list;
@@ -98,8 +98,6 @@ do_xor_speed(struct xor_block_template *tmpl, void *b1, void *b2)
mb(); /* prevent loop optimzation */
tmpl->do_2(BENCH_SIZE, b1, b2);
mb();
- count++;
- mb();
}
diff = ktime_sub(ktime_get(), start);
if (diff < min)
base-commit: ed4424f2fb02497b0ea92bf58c533c598c0da1d3
--
2.29.0.rc0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] crypto: xor - Remove unused variable count in do_xor_speed
2020-10-06 19:58 [PATCH] crypto: xor - Remove unused variable count in do_xor_speed Nathan Chancellor
@ 2020-10-06 21:35 ` Doug Anderson
2020-10-07 6:33 ` Ard Biesheuvel
2020-10-08 5:44 ` Herbert Xu
2 siblings, 0 replies; 4+ messages in thread
From: Doug Anderson @ 2020-10-06 21:35 UTC (permalink / raw)
To: Nathan Chancellor
Cc: Herbert Xu, David S. Miller, Ard Biesheuvel,
Linux Crypto Mailing List, LKML, clang-built-linux
Hi,
On Tue, Oct 6, 2020 at 12:59 PM Nathan Chancellor
<natechancellor@gmail.com> wrote:
>
> Clang warns:
>
> crypto/xor.c:101:4: warning: variable 'count' is uninitialized when used
> here [-Wuninitialized]
> count++;
> ^~~~~
> crypto/xor.c:86:17: note: initialize the variable 'count' to silence
> this warning
> int i, j, count;
> ^
> = 0
> 1 warning generated.
>
> After the refactoring to use ktime that happened in this function, count
> is only assigned, never read. Just remove the variable to get rid of the
> warning.
>
> Fixes: c055e3eae0f1 ("crypto: xor - use ktime for template benchmarking")
> Link: https://github.com/ClangBuiltLinux/linux/issues/1171
> Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
> ---
> crypto/xor.c | 4 +---
> 1 file changed, 1 insertion(+), 3 deletions(-)
Whoops! Sorry for missing this in my review.
Reviewed-by: Douglas Anderson <dianders@chromium.org>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] crypto: xor - Remove unused variable count in do_xor_speed
2020-10-06 19:58 [PATCH] crypto: xor - Remove unused variable count in do_xor_speed Nathan Chancellor
2020-10-06 21:35 ` Doug Anderson
@ 2020-10-07 6:33 ` Ard Biesheuvel
2020-10-08 5:44 ` Herbert Xu
2 siblings, 0 replies; 4+ messages in thread
From: Ard Biesheuvel @ 2020-10-07 6:33 UTC (permalink / raw)
To: Nathan Chancellor
Cc: Herbert Xu, David S. Miller, Douglas Anderson,
Linux Crypto Mailing List, Linux Kernel Mailing List,
clang-built-linux
On Tue, 6 Oct 2020 at 21:59, Nathan Chancellor <natechancellor@gmail.com> wrote:
>
> Clang warns:
>
> crypto/xor.c:101:4: warning: variable 'count' is uninitialized when used
> here [-Wuninitialized]
> count++;
> ^~~~~
> crypto/xor.c:86:17: note: initialize the variable 'count' to silence
> this warning
> int i, j, count;
> ^
> = 0
> 1 warning generated.
>
> After the refactoring to use ktime that happened in this function, count
> is only assigned, never read. Just remove the variable to get rid of the
> warning.
>
> Fixes: c055e3eae0f1 ("crypto: xor - use ktime for template benchmarking")
> Link: https://github.com/ClangBuiltLinux/linux/issues/1171
> Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
Acked-by: Ard Biesheuvel <ardb@kernel.org>
> ---
> crypto/xor.c | 4 +---
> 1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/crypto/xor.c b/crypto/xor.c
> index a0badbc03577..eacbf4f93990 100644
> --- a/crypto/xor.c
> +++ b/crypto/xor.c
> @@ -83,7 +83,7 @@ static void __init
> do_xor_speed(struct xor_block_template *tmpl, void *b1, void *b2)
> {
> int speed;
> - int i, j, count;
> + int i, j;
> ktime_t min, start, diff;
>
> tmpl->next = template_list;
> @@ -98,8 +98,6 @@ do_xor_speed(struct xor_block_template *tmpl, void *b1, void *b2)
> mb(); /* prevent loop optimzation */
> tmpl->do_2(BENCH_SIZE, b1, b2);
> mb();
> - count++;
> - mb();
> }
> diff = ktime_sub(ktime_get(), start);
> if (diff < min)
>
> base-commit: ed4424f2fb02497b0ea92bf58c533c598c0da1d3
> --
> 2.29.0.rc0
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] crypto: xor - Remove unused variable count in do_xor_speed
2020-10-06 19:58 [PATCH] crypto: xor - Remove unused variable count in do_xor_speed Nathan Chancellor
2020-10-06 21:35 ` Doug Anderson
2020-10-07 6:33 ` Ard Biesheuvel
@ 2020-10-08 5:44 ` Herbert Xu
2 siblings, 0 replies; 4+ messages in thread
From: Herbert Xu @ 2020-10-08 5:44 UTC (permalink / raw)
To: Nathan Chancellor
Cc: David S. Miller, Ard Biesheuvel, Douglas Anderson, linux-crypto,
linux-kernel, clang-built-linux
On Tue, Oct 06, 2020 at 12:58:48PM -0700, Nathan Chancellor wrote:
> Clang warns:
>
> crypto/xor.c:101:4: warning: variable 'count' is uninitialized when used
> here [-Wuninitialized]
> count++;
> ^~~~~
> crypto/xor.c:86:17: note: initialize the variable 'count' to silence
> this warning
> int i, j, count;
> ^
> = 0
> 1 warning generated.
>
> After the refactoring to use ktime that happened in this function, count
> is only assigned, never read. Just remove the variable to get rid of the
> warning.
>
> Fixes: c055e3eae0f1 ("crypto: xor - use ktime for template benchmarking")
> Link: https://github.com/ClangBuiltLinux/linux/issues/1171
> Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
> ---
> crypto/xor.c | 4 +---
> 1 file changed, 1 insertion(+), 3 deletions(-)
Patch applied. Thanks.
--
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2020-10-08 5:44 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-06 19:58 [PATCH] crypto: xor - Remove unused variable count in do_xor_speed Nathan Chancellor
2020-10-06 21:35 ` Doug Anderson
2020-10-07 6:33 ` Ard Biesheuvel
2020-10-08 5:44 ` Herbert Xu
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).