mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] hwmon: tps25990: Fix unreachable code in tps25990_read_word_data
@ 2024-12-05 21:33 Karol Przybylski
  2024-12-06  0:15 ` Guenter Roeck
  0 siblings, 1 reply; 2+ messages in thread
From: Karol Przybylski @ 2024-12-05 21:33 UTC (permalink / raw)
  To: karprzy7, skhan, jbrunet, jdelvare, linux; +Cc: linux-hwmon, linux-kernel

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

Signed-off-by: Karol Przybylski <karprzy7@gmail.com>
---
 drivers/hwmon/pmbus/tps25990.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/hwmon/pmbus/tps25990.c b/drivers/hwmon/pmbus/tps25990.c
index cc0f5c7ce..0d2655e69 100644
--- a/drivers/hwmon/pmbus/tps25990.c
+++ b/drivers/hwmon/pmbus/tps25990.c
@@ -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;
-- 
2.34.1


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

* Re: [PATCH] hwmon: tps25990: Fix unreachable code in tps25990_read_word_data
  2024-12-05 21:33 [PATCH] hwmon: tps25990: Fix unreachable code in tps25990_read_word_data Karol Przybylski
@ 2024-12-06  0:15 ` Guenter Roeck
  0 siblings, 0 replies; 2+ messages in thread
From: Guenter Roeck @ 2024-12-06  0:15 UTC (permalink / raw)
  To: Karol Przybylski; +Cc: skhan, jbrunet, jdelvare, linux-hwmon, linux-kernel

On Thu, Dec 05, 2024 at 10:33:15PM +0100, Karol Przybylski wrote:
> 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
> 
> Signed-off-by: Karol Przybylski <karprzy7@gmail.com>

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

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

end of thread, other threads:[~2024-12-06  0:15 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-12-05 21:33 [PATCH] hwmon: tps25990: Fix unreachable code in tps25990_read_word_data Karol Przybylski
2024-12-06  0:15 ` Guenter Roeck

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®