lkml.org 
[lkml]   [2023]   [Apr]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH v1 2/2] hwmon: pmbus: Add ltc4286 driver
From
On 4/25/23 06:45, Andi Shyti wrote:
> Hi Delphine,
>
> On top of Guenter's comments,
>
> [...]
>
>> +config SENSORS_LTC4286
>> + bool "Linear Technologies LTC4286"
>> + help
>> + If you say yes here you get hardware monitoring support for Linear
>> + Technology LTC4286.
>
> could you add a couple of words more here?
>
> [...]
>
>> +static int ltc4286_probe(struct i2c_client *client,
>> + const struct i2c_device_id *id)
>> +{
>> + int ret;
>> + u8 block_buffer[I2C_SMBUS_BLOCK_MAX + 1];
>> + struct device *dev = &client->dev;
>> + struct pmbus_driver_info *info;
>> + u32 rsense;
>> +
>> + ret = i2c_smbus_read_block_data(client, PMBUS_MFR_ID, block_buffer);
>> + if (ret < 0) {
>> + dev_err(&client->dev, "failed to read manufacturer id\n");
>
> you can use dev_err_probe() here:
>
> return dev_err_probe(&client->dev, err, "failed to read manufacturer id\n");
>
>> + return ret;
>> + }
>> +
>> + /* Refer to ltc4286 datasheet page 20
>> + * the default manufacturer id is LTC
>> + */
>> + if (ret != LTC4286_MFR_ID_SIZE ||
>> + strncmp(block_buffer, "LTC", LTC4286_MFR_ID_SIZE)) {
>> + dev_err(&client->dev, "unsupported manufacturer id\n");
>> + return -ENODEV;
>> + }
>> +
>> + ret = i2c_smbus_read_block_data(client, PMBUS_MFR_MODEL, block_buffer);
>> + if (ret < 0) {
>> + dev_err(&client->dev, "failed to read manufacturer model\n");
>> + return ret;
>> + }
>
> Is this read really needed?
>

It only makes sense if the returned string is actually validated.
Otherwise no.

Guenter

\
 
 \ /
  Last update: 2023-04-25 16:10    [W:0.177 / U:0.020 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site