linux-hwmon.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Guenter Roeck <linux@roeck-us.net>
To: Andi Shyti <andi.shyti@kernel.org>,
	Delphine CC Chiu <Delphine_CC_Chiu@Wiwynn.com>
Cc: patrick@stwcx.xyz, Jean Delvare <jdelvare@suse.com>,
	Rob Herring <robh+dt@kernel.org>,
	Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>,
	linux-i2c@vger.kernel.org, linux-hwmon@vger.kernel.org,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v1 2/2] hwmon: pmbus: Add ltc4286 driver
Date: Tue, 25 Apr 2023 07:09:20 -0700	[thread overview]
Message-ID: <ccbced2f-0258-cfd7-2f91-e246dadae8fb@roeck-us.net> (raw)
In-Reply-To: <20230425134537.pzsplcpkrog2552r@intel.intel>

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


  reply	other threads:[~2023-04-25 14:09 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-24 10:13 [PATCH v1 0/2] LTC4286 and LTC4287 driver support Delphine CC Chiu
2023-04-24 10:13 ` [PATCH v1 1/2] dt-bindings: hwmon: Add lltc ltc4286 driver bindings Delphine CC Chiu
2023-04-24 13:28   ` Rob Herring
2023-04-24 13:49   ` Guenter Roeck
2023-07-24  2:12     ` Delphine_CC_Chiu/WYHQ/Wiwynn
2023-07-24  3:21       ` Guenter Roeck
2023-08-02  5:31         ` Delphine_CC_Chiu/WYHQ/Wiwynn
2023-08-04 15:56           ` Guenter Roeck
2023-04-24 10:13 ` [PATCH v1 2/2] hwmon: pmbus: Add ltc4286 driver Delphine CC Chiu
2023-04-24 14:13   ` Guenter Roeck
2023-07-24  6:03     ` Delphine_CC_Chiu/WYHQ/Wiwynn
2023-07-24  6:56       ` Guenter Roeck
2023-08-15  9:08         ` Delphine_CC_Chiu/WYHQ/Wiwynn
2023-04-25  4:48   ` kernel test robot
2023-04-25 13:45   ` Andi Shyti
2023-04-25 14:09     ` Guenter Roeck [this message]
2023-07-24  2:07       ` Delphine_CC_Chiu/WYHQ/Wiwynn
2023-07-24  2:22     ` Delphine_CC_Chiu/WYHQ/Wiwynn
2023-04-30 17:30   ` kernel test robot
2023-05-05 23:14   ` kernel test robot
2023-07-24 10:05 ` [PATCH 1/2] dt-bindings: hwmon: Add lltc ltc4286 driver bindings Delphine CC Chiu
2023-07-24 10:05   ` [PATCH 2/2] hwmon: pmbus: Add ltc4286 driver Delphine CC Chiu
2023-07-24 13:55     ` Guenter Roeck
2023-07-26 15:42     ` Andi Shyti
2023-07-24 10:09   ` [PATCH 1/2] dt-bindings: hwmon: Add lltc ltc4286 driver bindings Krzysztof Kozlowski
2023-07-26 16:44   ` Rob Herring
2023-08-08  2:35     ` Delphine_CC_Chiu/WYHQ/Wiwynn

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ccbced2f-0258-cfd7-2f91-e246dadae8fb@roeck-us.net \
    --to=linux@roeck-us.net \
    --cc=Delphine_CC_Chiu@Wiwynn.com \
    --cc=andi.shyti@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=jdelvare@suse.com \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=linux-hwmon@vger.kernel.org \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=patrick@stwcx.xyz \
    --cc=robh+dt@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).