All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] hwmon: (pmbus) Fix return value from pmbus_update_byte_data()
@ 2026-07-28 15:46 Guenter Roeck
  2026-07-28 15:54 ` sashiko-bot
  0 siblings, 1 reply; 2+ messages in thread
From: Guenter Roeck @ 2026-07-28 15:46 UTC (permalink / raw)
  To: Hardware Monitoring; +Cc: Guenter Roeck

pmbus_update_byte_data() is supposed to return a negative error code or 0.
However, if no change is made to the register, it actually returns the
register value. This can result in problems if the calling code explicitly
expects to see an error code or 0.

Fix it to return 0 on success or the error code as expected.

Fixes: 11c119986f270 ("hwmon: (pmbus) add helpers for byte write and read modify write")
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
---
 drivers/hwmon/pmbus/pmbus_core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/hwmon/pmbus/pmbus_core.c b/drivers/hwmon/pmbus/pmbus_core.c
index 24c4d502733c..aac86d4f64b5 100644
--- a/drivers/hwmon/pmbus/pmbus_core.c
+++ b/drivers/hwmon/pmbus/pmbus_core.c
@@ -513,7 +513,7 @@ int pmbus_update_byte_data(struct i2c_client *client, int page, u8 reg,
 	if (tmp != rv)
 		rv = _pmbus_write_byte_data(client, page, reg, tmp);
 
-	return rv;
+	return rv < 0 ? rv : 0;
 }
 EXPORT_SYMBOL_NS_GPL(pmbus_update_byte_data, "PMBUS");
 
-- 
2.45.2


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

* Re: [PATCH] hwmon: (pmbus) Fix return value from pmbus_update_byte_data()
  2026-07-28 15:46 [PATCH] hwmon: (pmbus) Fix return value from pmbus_update_byte_data() Guenter Roeck
@ 2026-07-28 15:54 ` sashiko-bot
  0 siblings, 0 replies; 2+ messages in thread
From: sashiko-bot @ 2026-07-28 15:54 UTC (permalink / raw)
  To: Guenter Roeck; +Cc: linux-hwmon

> pmbus_update_byte_data() is supposed to return a negative error code or 0.
> However, if no change is made to the register, it actually returns the
> register value. This can result in problems if the calling code explicitly
> expects to see an error code or 0.
> 
> Fix it to return 0 on success or the error code as expected.
> 
> Fixes: 11c119986f270 ("hwmon: (pmbus) add helpers for byte write and read modify write")
> Signed-off-by: Guenter Roeck <linux@roeck-us.net>

Sashiko has reviewed this patch and found no issues. It looks great!

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260728154657.3910899-1-linux@roeck-us.net?part=1


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

end of thread, other threads:[~2026-07-28 15:54 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-28 15:46 [PATCH] hwmon: (pmbus) Fix return value from pmbus_update_byte_data() Guenter Roeck
2026-07-28 15:54 ` sashiko-bot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.