[PATCH 21/31] hwmon: (pmbus/max20730) use 4-argument i2c_smbus_read_block_data()

From: Dmitry Torokhov

Date: Sat Oct 24 2026 - 23:08:44 EST


Pass sizeof(buf) - 1 to i2c_smbus_read_block_data() in max20730_probe()
to leave space for the NUL terminator.

Signed-off-by: Dmitry Torokhov <dmitry.torokhov@xxxxxxxxx>
---
drivers/hwmon/pmbus/max20730.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/hwmon/pmbus/max20730.c b/drivers/hwmon/pmbus/max20730.c
index 4031f894e6ae..b48ae06e3fa0 100644
--- a/drivers/hwmon/pmbus/max20730.c
+++ b/drivers/hwmon/pmbus/max20730.c
@@ -672,7 +672,8 @@ static int max20730_probe(struct i2c_client *client)
I2C_FUNC_SMBUS_BLOCK_DATA))
return -ENODEV;

- 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) {
dev_err(&client->dev, "Failed to read Manufacturer ID\n");
return ret;
@@ -693,7 +694,8 @@ static int max20730_probe(struct i2c_client *client)
* a mismatch. If that doesn't work for all chips, we may have
* to remove this check.
*/
- 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) {
dev_err(dev, "Failed to read Manufacturer Model\n");
return ret;
@@ -704,7 +706,8 @@ static int max20730_probe(struct i2c_client *client)
return -ENODEV;
}

- 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) {
dev_err(dev, "Failed to read Manufacturer Revision\n");
return ret;

--
2.56.0.257.gf7497c7d27-goog