Skip to contentSkip to conversation

tpm/eventlog: remove redundant assignment to variabel ret

PATCH In review Colin Ian King 2 participants 2 messages Apr 11, 2024 – Apr 13, 2024

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tpm/eventlog: remove redundant assignment to variabel ret

Variable ret is being assigned and error code that is never read, it is either being re-assigned in an error exit path or never referenced again on the non-error path. The assignment is redundant and can be removed.

Cleans up clang scan build warning:
drivers/char/tpm/eventlog/acpi.c:145:2: warning: Value stored to 'ret' is never read [deadcode.DeadStores]

---
 drivers/char/tpm/eventlog/acpi.c | 1 -
 1 file changed, 1 deletion(-)
drivers/char/tpm/eventlog/acpi.c +0 -1
index bd757d836c5c..69533d0bfb51 100644
@@ -142,7 +142,6 @@ int tpm_read_log_acpi(struct tpm_chip *chip)
 
 	log->bios_event_log_end = log->bios_event_log + len;
 
-	ret = -EIO;
 	virt = acpi_os_map_iomem(start, len);
 	if (!virt) {
 		dev_warn(&chip->dev, "%s: Failed to map ACPI memory\n", __func__);
Signature · 1 line
2.39.2
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 18 lines · Colin Ian King

Variable ret is being assigned and error code that is never read, it is either being re-assigned in an error exit path or never referenced again on the non-error path. The assignment is redundant and can be removed.

Cleans up clang scan build warning:
drivers/char/tpm/eventlog/acpi.c:145:2: warning: Value stored to 'ret' is never read [deadcode.DeadStores]

---
 drivers/char/tpm/eventlog/acpi.c | 1 -
 1 file changed, 1 deletion(-)
drivers/char/tpm/eventlog/acpi.c +0 -0
index bd757d836c5c..69533d0bfb51 100644

drivers/char/tpm/eventlog/acpi.c int tpm_read_log_acpi(struct tpm_chip *chip) · line 147

Quoted 7 lines
drivers/char/tpm/eventlog/acpi.c +0 -1
@@ -142,7 +142,6 @@ int tpm_read_log_acpi(struct tpm_chip *chip)
 
 	log->bios_event_log_end = log->bios_event_log + len;
 
-	ret = -EIO;
 	virt = acpi_os_map_iomem(start, len);
 	if (!virt) {
 		dev_warn(&chip->dev, "%s: Failed to map ACPI memory\n", __func__);

Thanks!

BR, Jarkko