Skip to contentSkip to conversation

ACPI: pfr_telemetry: remove redundant error check on ret

PATCH Applied Colin Ian King 2 participants 2 messages Oct 14, 2024 – Oct 24, 2024

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

PATCH 1/1 ACPI: pfr_telemetry: remove redundant error check on ret

The variable ret is initialized to zero and a littler later in the PFRT_LOG_IOC_GET_INFO case of a switch statement is being checked for negative error value. Since ret has not been re-assigned since the initialization ret can never be less than zero so the check is redundant and can be removed. Remove it.

---
 drivers/acpi/pfr_telemetry.c | 3 ---
 1 file changed, 3 deletions(-)
drivers/acpi/pfr_telemetry.c +0 -3
index 998264a7333d..a32798787ed9 100644
@@ -272,9 +272,6 @@ static long pfrt_log_ioctl(struct file *file, unsigned int cmd, unsigned long ar
 
 	case PFRT_LOG_IOC_GET_INFO:
 		info.log_level = get_pfrt_log_level(pfrt_log_dev);
-		if (ret < 0)
-			return ret;
-
 		info.log_type = pfrt_log_dev->info.log_type;
 		info.log_revid = pfrt_log_dev->info.log_revid;
 		if (copy_to_user(p, &info, sizeof(info)))
Signature · 1 line
2.39.5
maintainer Applied
#1 lore raw
Quoted 17 lines · Colin Ian King

The variable ret is initialized to zero and a littler later in the PFRT_LOG_IOC_GET_INFO case of a switch statement is being checked for negative error value. Since ret has not been re-assigned since the initialization ret can never be less than zero so the check is redundant and can be removed. Remove it.

---
 drivers/acpi/pfr_telemetry.c | 3 ---
 1 file changed, 3 deletions(-)
drivers/acpi/pfr_telemetry.c +0 -0
index 998264a7333d..a32798787ed9 100644

drivers/acpi/pfr_telemetry.c static long pfrt_log_ioctl(struct file *file, unsigned int cmd, unsigned long ar

Quoted 10 lines
drivers/acpi/pfr_telemetry.c +0 -4
@@ -272,9 +272,6 @@ static long pfrt_log_ioctl(struct file *file, unsigned int cmd, unsigned long ar
 
        case PFRT_LOG_IOC_GET_INFO:
                info.log_level = get_pfrt_log_level(pfrt_log_dev);
-               if (ret < 0)
-                       return ret;
-
                info.log_type = pfrt_log_dev->info.log_type;
                info.log_revid = pfrt_log_dev->info.log_revid;
                if (copy_to_user(p, &info, sizeof(info)))
--

Applied as 6.13 material, thanks!