Skip to contentSkip to conversation

hwmon: tps25990: Fix unreachable code in tps25990_read_word_data

PATCH In review Karol Przybylski 2 participants 2 messages Dec 5, 2024 – Dec 6, 2024

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

PATCH 1/1 hwmon: tps25990: Fix unreachable code in tps25990_read_word_data

The tps25990_read_word_data function contains a block of unreachable code caused by the syntactic structure in the PMBUS_VIRT_READ_IIN_MAX case.

Specifically, the return TPS25990_READ_IIN_PEAK; statement immediately exits the function, making the next lines unreachable.

This patch removes the return statement, leaving the expected handling.

Discovered in coverity: CID 1602227

---
 drivers/hwmon/pmbus/tps25990.c | 1 -
 1 file changed, 1 deletion(-)
drivers/hwmon/pmbus/tps25990.c +0 -1
index cc0f5c7ce..0d2655e69 100644
@@ -130,7 +130,6 @@ static int tps25990_read_word_data(struct i2c_client *client,
 		break;
 
 	case PMBUS_VIRT_READ_IIN_MAX:
-		return TPS25990_READ_IIN_PEAK;
 		ret = pmbus_read_word_data(client, page, phase,
 					   TPS25990_READ_IIN_PEAK);
 		break;
Signature · 1 line
2.34.1
maintainer
#1 lore raw
Quoted 9 lines · Karol Przybylski

The tps25990_read_word_data function contains a block of unreachable code caused by the syntactic structure in the PMBUS_VIRT_READ_IIN_MAX case.

Specifically, the return TPS25990_READ_IIN_PEAK; statement immediately exits the function, making the next lines unreachable.

This patch removes the return statement, leaving the expected handling.

Discovered in coverity: CID 1602227

Thanks a log for the patch. I squashed it into the patch introducing the problem. Please note that the above commit message is missing line breaks.

Thanks,
Guenter