mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] lib: remove redundant assignment to variable ret
@ 2021-12-30 13:45 Colin Ian King
  2022-01-06 19:03 ` Jarkko Sakkinen
  0 siblings, 1 reply; 2+ messages in thread
From: Colin Ian King @ 2021-12-30 13:45 UTC (permalink / raw)
  To: Jarkko Sakkinen, Andrew Morton; +Cc: kernel-janitors, linux-kernel

Variable ret is being assigned a value that is never read. If the
for-loop is entered then ret is immediately re-assigned a new
value. If the for-loop is not executed ret is never read. The
assignment is redundant and can be removed.

Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
---
 lib/asn1_encoder.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/lib/asn1_encoder.c b/lib/asn1_encoder.c
index 27bbe891714f..0fd3c454a468 100644
--- a/lib/asn1_encoder.c
+++ b/lib/asn1_encoder.c
@@ -164,8 +164,6 @@ asn1_encode_oid(unsigned char *data, const unsigned char *end_data,
 
 	data_len -= 3;
 
-	ret = 0;
-
 	for (i = 2; i < oid_len; i++) {
 		ret = asn1_encode_oid_digit(&d, &data_len, oid[i]);
 		if (ret < 0)
-- 
2.33.1


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

* Re: [PATCH] lib: remove redundant assignment to variable ret
  2021-12-30 13:45 [PATCH] lib: remove redundant assignment to variable ret Colin Ian King
@ 2022-01-06 19:03 ` Jarkko Sakkinen
  0 siblings, 0 replies; 2+ messages in thread
From: Jarkko Sakkinen @ 2022-01-06 19:03 UTC (permalink / raw)
  To: Colin Ian King; +Cc: Andrew Morton, kernel-janitors, linux-kernel

On Thu, Dec 30, 2021 at 01:45:57PM +0000, Colin Ian King wrote:
> Variable ret is being assigned a value that is never read. If the
> for-loop is entered then ret is immediately re-assigned a new
> value. If the for-loop is not executed ret is never read. The
> assignment is redundant and can be removed.
> 
> Signed-off-by: Colin Ian King <colin.i.king@gmail.com>


Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org>

BR,
Jarkko

> ---
>  lib/asn1_encoder.c | 2 --
>  1 file changed, 2 deletions(-)
> 
> diff --git a/lib/asn1_encoder.c b/lib/asn1_encoder.c
> index 27bbe891714f..0fd3c454a468 100644
> --- a/lib/asn1_encoder.c
> +++ b/lib/asn1_encoder.c
> @@ -164,8 +164,6 @@ asn1_encode_oid(unsigned char *data, const unsigned char *end_data,
>  
>  	data_len -= 3;
>  
> -	ret = 0;
> -
>  	for (i = 2; i < oid_len; i++) {
>  		ret = asn1_encode_oid_digit(&d, &data_len, oid[i]);
>  		if (ret < 0)
> -- 
> 2.33.1
> 

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

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

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-30 13:45 [PATCH] lib: remove redundant assignment to variable ret Colin Ian King
2022-01-06 19:03 ` Jarkko Sakkinen

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

all inboxes | Powered by JetHome®