All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] hwrng: optee-rng: remove redundant initialization to variable rng_size
@ 2022-04-24 18:11 Colin Ian King
  2022-04-25  5:52 ` Sumit Garg
  2022-04-29  5:50 ` Herbert Xu
  0 siblings, 2 replies; 3+ messages in thread
From: Colin Ian King @ 2022-04-24 18:11 UTC (permalink / raw)
  To: Sumit Garg, Matt Mackall, Herbert Xu, op-tee, linux-crypto
  Cc: kernel-janitors, linux-kernel

Variable rng_size is being initialized with a value that is never read,
the variable is being re-assigned later on. The initialization is
redundant and can be removed.

Cleans up cppcheck warning:
Variable 'rng_size' is assigned a value that is never used.

Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
---
 drivers/char/hw_random/optee-rng.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/char/hw_random/optee-rng.c b/drivers/char/hw_random/optee-rng.c
index a948c0727b2b..96b5d546d136 100644
--- a/drivers/char/hw_random/optee-rng.c
+++ b/drivers/char/hw_random/optee-rng.c
@@ -115,7 +115,7 @@ static size_t get_optee_rng_data(struct optee_rng_private *pvt_data,
 static int optee_rng_read(struct hwrng *rng, void *buf, size_t max, bool wait)
 {
 	struct optee_rng_private *pvt_data = to_optee_rng_private(rng);
-	size_t read = 0, rng_size = 0;
+	size_t read = 0, rng_size;
 	int timeout = 1;
 	u8 *data = buf;
 
-- 
2.35.1


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

* Re: [PATCH] hwrng: optee-rng: remove redundant initialization to variable rng_size
  2022-04-24 18:11 [PATCH] hwrng: optee-rng: remove redundant initialization to variable rng_size Colin Ian King
@ 2022-04-25  5:52 ` Sumit Garg
  2022-04-29  5:50 ` Herbert Xu
  1 sibling, 0 replies; 3+ messages in thread
From: Sumit Garg @ 2022-04-25  5:52 UTC (permalink / raw)
  To: Colin Ian King
  Cc: Matt Mackall, Herbert Xu, op-tee, linux-crypto, kernel-janitors,
	linux-kernel

On Sun, 24 Apr 2022 at 23:41, Colin Ian King <colin.i.king@gmail.com> wrote:
>
> Variable rng_size is being initialized with a value that is never read,
> the variable is being re-assigned later on. The initialization is
> redundant and can be removed.
>
> Cleans up cppcheck warning:
> Variable 'rng_size' is assigned a value that is never used.
>
> Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
> ---
>  drivers/char/hw_random/optee-rng.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>

Reviewed-by: Sumit Garg <sumit.garg@linaro.org>

-Sumit

> diff --git a/drivers/char/hw_random/optee-rng.c b/drivers/char/hw_random/optee-rng.c
> index a948c0727b2b..96b5d546d136 100644
> --- a/drivers/char/hw_random/optee-rng.c
> +++ b/drivers/char/hw_random/optee-rng.c
> @@ -115,7 +115,7 @@ static size_t get_optee_rng_data(struct optee_rng_private *pvt_data,
>  static int optee_rng_read(struct hwrng *rng, void *buf, size_t max, bool wait)
>  {
>         struct optee_rng_private *pvt_data = to_optee_rng_private(rng);
> -       size_t read = 0, rng_size = 0;
> +       size_t read = 0, rng_size;
>         int timeout = 1;
>         u8 *data = buf;
>
> --
> 2.35.1
>

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

* Re: [PATCH] hwrng: optee-rng: remove redundant initialization to variable rng_size
  2022-04-24 18:11 [PATCH] hwrng: optee-rng: remove redundant initialization to variable rng_size Colin Ian King
  2022-04-25  5:52 ` Sumit Garg
@ 2022-04-29  5:50 ` Herbert Xu
  1 sibling, 0 replies; 3+ messages in thread
From: Herbert Xu @ 2022-04-29  5:50 UTC (permalink / raw)
  To: Colin Ian King
  Cc: Sumit Garg, Matt Mackall, op-tee, linux-crypto, kernel-janitors,
	linux-kernel

On Sun, Apr 24, 2022 at 07:11:56PM +0100, Colin Ian King wrote:
> Variable rng_size is being initialized with a value that is never read,
> the variable is being re-assigned later on. The initialization is
> redundant and can be removed.
> 
> Cleans up cppcheck warning:
> Variable 'rng_size' is assigned a value that is never used.
> 
> Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
> ---
>  drivers/char/hw_random/optee-rng.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

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] 3+ messages in thread

end of thread, other threads:[~2022-04-29  5:51 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-24 18:11 [PATCH] hwrng: optee-rng: remove redundant initialization to variable rng_size Colin Ian King
2022-04-25  5:52 ` Sumit Garg
2022-04-29  5:50 ` Herbert Xu

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.