[PATCH 18/31] hwmon: (pmbus/lx1308) use 4-argument i2c_smbus_read_block_data()
From: Dmitry Torokhov
Date: Sat Oct 24 2026 - 23:08:19 EST
Pass sizeof(buf) - 1 to i2c_smbus_read_block_data() in lx1308_probe()
to leave space for the NUL terminator.
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@xxxxxxxxx>
---
drivers/hwmon/pmbus/lx1308.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/drivers/hwmon/pmbus/lx1308.c b/drivers/hwmon/pmbus/lx1308.c
index 0c453393796b..37519bda594f 100644
--- a/drivers/hwmon/pmbus/lx1308.c
+++ b/drivers/hwmon/pmbus/lx1308.c
@@ -151,7 +151,8 @@ static int lx1308_probe(struct i2c_client *client)
const struct i2c_device_id *mid;
int ret;
- ret = i2c_smbus_read_block_data(client, PMBUS_MFR_ID, buf);
+ ret = i2c_smbus_read_block_data(client, PMBUS_MFR_ID,
+ sizeof(buf) - 1, buf);
if (ret < 0)
return dev_err_probe(&client->dev, ret,
"Failed to read manufacturer id\n");
@@ -161,7 +162,8 @@ static int lx1308_probe(struct i2c_client *client)
return dev_err_probe(&client->dev, -ENODEV,
"Unsupported Manufacturer ID '%s'\n", buf);
- ret = i2c_smbus_read_block_data(client, PMBUS_MFR_MODEL, buf);
+ ret = i2c_smbus_read_block_data(client, PMBUS_MFR_MODEL,
+ sizeof(buf) - 1, buf);
if (ret < 0)
return dev_err_probe(&client->dev, ret,
"Failed to read Manufacturer Model\n");
@@ -175,7 +177,8 @@ static int lx1308_probe(struct i2c_client *client)
return dev_err_probe(&client->dev, -ENODEV,
"Unsupported Manufacturer Model '%s'\n", buf);
- ret = i2c_smbus_read_block_data(client, PMBUS_MFR_REVISION, buf);
+ ret = i2c_smbus_read_block_data(client, PMBUS_MFR_REVISION,
+ sizeof(buf) - 1, buf);
if (ret < 0)
return dev_err_probe(&client->dev, ret,
"Failed to read Manufacturer Revision\n");
--
2.56.0.257.gf7497c7d27-goog