All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] hwmon: (sht4x) Reject incomplete heater command transfers
@ 2026-10-17 20:52 Baek Kyu, Kim
  2026-10-17 20:54 ` sashiko-bot
  0 siblings, 1 reply; 2+ messages in thread
From: Baek Kyu, Kim @ 2026-10-17 20:52 UTC (permalink / raw)
  To: linux; +Cc: linux-hwmon, linux-kernel, Baek Kyu, Kim

heater_enable_store() treats a zero return from i2c_master_send() as
success. It updates the heater state and returns count, so another
attempt to enable the heater fails with -EBUSY.

i2c-virtio can return zero when the first message fails. Require
SHT4X_CMD_LEN before updating the heater state, as sht4x_probe()
already does for the reset command.

Fixes: 0eed6fc3d2b9 ("hwmon: (sht4x): add heater support")
Signed-off-by: Baek Kyu, Kim <pocj8ur4in@gmail.com>
---
Tested with an emulated I2C adapter under ARM64 QEMU. A zero return
reproduces the false success and -EBUSY on retry; both are fixed by
this change. No physical sensor was tested.

 drivers/hwmon/sht4x.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/hwmon/sht4x.c b/drivers/hwmon/sht4x.c
index a97dda9e92dc..c4b3db55de8b 100644
--- a/drivers/hwmon/sht4x.c
+++ b/drivers/hwmon/sht4x.c
@@ -287,2 +287,4 @@ static ssize_t heater_enable_store(struct device *dev,
 		return ret;
+	if (ret != SHT4X_CMD_LEN)
+		return -EIO;
 

base-commit: 58161ead29e50d70a317ea26b472e0c7508e69da
-- 
2.55.0


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

* Re: [PATCH] hwmon: (sht4x) Reject incomplete heater command transfers
  2026-10-17 20:52 [PATCH] hwmon: (sht4x) Reject incomplete heater command transfers Baek Kyu, Kim
@ 2026-10-17 20:54 ` sashiko-bot
  0 siblings, 0 replies; 2+ messages in thread
From: sashiko-bot @ 2026-10-17 20:54 UTC (permalink / raw)
  To: Baek Kyu, Kim; +Cc: linux-hwmon

> heater_enable_store() treats a zero return from i2c_master_send() as
> success. It updates the heater state and returns count, so another
> attempt to enable the heater fails with -EBUSY.
> 
> i2c-virtio can return zero when the first message fails. Require
> SHT4X_CMD_LEN before updating the heater state, as sht4x_probe()
> already does for the reset command.
> 
> Fixes: 0eed6fc3d2b9 ("hwmon: (sht4x): add heater support")
> Signed-off-by: Baek Kyu, Kim <pocj8ur4in@gmail.com>

Sashiko has reviewed this patch and found no issues.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261017205234.1084949-1-pocj8ur4in@gmail.com?part=1


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

end of thread, other threads:[~2026-10-17 20:54 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-17 20:52 [PATCH] hwmon: (sht4x) Reject incomplete heater command transfers Baek Kyu, Kim
2026-10-17 20: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.