diff mbox series

[next] tpm: remove redundant variable len

Message ID 20230616170730.2343540-1-colin.i.king@gmail.com (mailing list archive)
State New, archived
Headers show
Series [next] tpm: remove redundant variable len | expand

Commit Message

Colin Ian King June 16, 2023, 5:07 p.m. UTC
Variable len is being accumulated but the value is never read. It is
redundant and can be removed. Cleans up clang scan build warning:

drivers/char/tpm/eventlog/tpm1.c:276:2: warning: Value stored to 'len' is never read [deadcode.DeadStores]

Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
---
 drivers/char/tpm/eventlog/tpm1.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

Jerry Snitselaar June 29, 2023, 5:02 p.m. UTC | #1
On Fri, Jun 16, 2023 at 06:07:30PM +0100, Colin Ian King wrote:
> Variable len is being accumulated but the value is never read. It is
> redundant and can be removed. Cleans up clang scan build warning:
> 
> drivers/char/tpm/eventlog/tpm1.c:276:2: warning: Value stored to 'len' is never read [deadcode.DeadStores]
> 
> Signed-off-by: Colin Ian King <colin.i.king@gmail.com>

Reviewed-by: Jerry Snitselaar <jsnitsel@redhat.com>

> ---
>  drivers/char/tpm/eventlog/tpm1.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/char/tpm/eventlog/tpm1.c b/drivers/char/tpm/eventlog/tpm1.c
> index 8aa9057601d6..12ee42a31c71 100644
> --- a/drivers/char/tpm/eventlog/tpm1.c
> +++ b/drivers/char/tpm/eventlog/tpm1.c
> @@ -251,7 +251,6 @@ static int tpm1_binary_bios_measurements_show(struct seq_file *m, void *v)
>  
>  static int tpm1_ascii_bios_measurements_show(struct seq_file *m, void *v)
>  {
> -	int len = 0;
>  	char *eventname;
>  	struct tcpa_event *event = v;
>  	unsigned char *event_entry =
> @@ -273,7 +272,7 @@ static int tpm1_ascii_bios_measurements_show(struct seq_file *m, void *v)
>  	/* 3rd: event type identifier */
>  	seq_printf(m, " %02x", do_endian_conversion(event->event_type));
>  
> -	len += get_event_name(eventname, event, event_entry);
> +	get_event_name(eventname, event, event_entry);
>  
>  	/* 4th: eventname <= max + \'0' delimiter */
>  	seq_printf(m, " %s\n", eventname);
> -- 
> 2.39.2
>
Jarkko Sakkinen July 11, 2023, 12:26 a.m. UTC | #2
On Fri Jun 16, 2023 at 8:07 PM EEST, Colin Ian King wrote:
> Variable len is being accumulated but the value is never read. It is
> redundant and can be removed. Cleans up clang scan build warning:
>
> drivers/char/tpm/eventlog/tpm1.c:276:2: warning: Value stored to 'len' is never read [deadcode.DeadStores]
>
> Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
> ---
>  drivers/char/tpm/eventlog/tpm1.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/char/tpm/eventlog/tpm1.c b/drivers/char/tpm/eventlog/tpm1.c
> index 8aa9057601d6..12ee42a31c71 100644
> --- a/drivers/char/tpm/eventlog/tpm1.c
> +++ b/drivers/char/tpm/eventlog/tpm1.c
> @@ -251,7 +251,6 @@ static int tpm1_binary_bios_measurements_show(struct seq_file *m, void *v)
>  
>  static int tpm1_ascii_bios_measurements_show(struct seq_file *m, void *v)
>  {
> -	int len = 0;
>  	char *eventname;
>  	struct tcpa_event *event = v;
>  	unsigned char *event_entry =
> @@ -273,7 +272,7 @@ static int tpm1_ascii_bios_measurements_show(struct seq_file *m, void *v)
>  	/* 3rd: event type identifier */
>  	seq_printf(m, " %02x", do_endian_conversion(event->event_type));
>  
> -	len += get_event_name(eventname, event, event_entry);
> +	get_event_name(eventname, event, event_entry);
>  
>  	/* 4th: eventname <= max + \'0' delimiter */
>  	seq_printf(m, " %s\n", eventname);
> -- 
> 2.39.2

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

BR, Jarkko
diff mbox series

Patch

diff --git a/drivers/char/tpm/eventlog/tpm1.c b/drivers/char/tpm/eventlog/tpm1.c
index 8aa9057601d6..12ee42a31c71 100644
--- a/drivers/char/tpm/eventlog/tpm1.c
+++ b/drivers/char/tpm/eventlog/tpm1.c
@@ -251,7 +251,6 @@  static int tpm1_binary_bios_measurements_show(struct seq_file *m, void *v)
 
 static int tpm1_ascii_bios_measurements_show(struct seq_file *m, void *v)
 {
-	int len = 0;
 	char *eventname;
 	struct tcpa_event *event = v;
 	unsigned char *event_entry =
@@ -273,7 +272,7 @@  static int tpm1_ascii_bios_measurements_show(struct seq_file *m, void *v)
 	/* 3rd: event type identifier */
 	seq_printf(m, " %02x", do_endian_conversion(event->event_type));
 
-	len += get_event_name(eventname, event, event_entry);
+	get_event_name(eventname, event, event_entry);
 
 	/* 4th: eventname <= max + \'0' delimiter */
 	seq_printf(m, " %s\n", eventname);