mirror of
https://github.com/torvalds/linux.git
synced 2026-11-07 06:17:02 +01:00
hwmon: (sht4x) Reject incomplete heater command transfers
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: 0eed6fc3d2 ("hwmon: (sht4x): add heater support")
Cc: stable@vger.kernel.org
Signed-off-by: Baek Kyu, Kim <pocj8ur4in@gmail.com>
Link: https://patch.msgid.link/20261017205234.1084949-1-pocj8ur4in@gmail.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
This commit is contained in:
parent
f63aaa529c
commit
0e1d292233
|
|
@ -287,6 +287,8 @@ static ssize_t heater_enable_store(struct device *dev,
|
|||
ret = i2c_master_send(data->client, &cmd, SHT4X_CMD_LEN);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
if (ret != SHT4X_CMD_LEN)
|
||||
return -EIO;
|
||||
|
||||
data->heating_complete = get_jiffies_64() + msecs_to_jiffies(heating_time_bound);
|
||||
data->data_pending = true;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user