Re: [PATCH v3] hwmon: (lm90) Switch channel parsing to fwnode APIs

Guenter Roeck <[email protected]> Thu, 30 Jul 2026 08:10:58 -0700
Newsgroups org.kernel.vger.linux-hwmon,dev.linux.lists.sashiko-reviews
Message-ID <[email protected]>
On 7/30/26 02:43, [email protected] wrote:
> Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
> 
> Pre-existing issues:
> - [Critical] Switching to `device_for_each_child_node_scoped()` exposes a critical pre-existing bug in the core `fwnode_get_next_child_node()` which causes an infinite loop and double-frees if a device has both OF and secondary firmware nodes.
> --
> 
> --- Patch [1]: [PATCH v3] hwmon: (lm90) Switch channel parsing to fwnode APIs ---
> commit 39e5cdd2d72333fe0fa7b34c25ad27651948158c
> Author: Flaviu Nistor <[email protected]>
> 
> hwmon: (lm90) Switch channel parsing to fwnode APIs
> 
> Replace OF property handling with fwnode in the probe function to read
> the channels properties, improving the driver compatibility since this
> method is not limited to Device Tree only.
> Add also the needed headers for explicit include and clean up related
> function naming.
> 
>> diff --git a/drivers/hwmon/lm90.c b/drivers/hwmon/lm90.c
>> index 4b9c0ccdf2609..03779c1a251a2 100644
>> --- a/drivers/hwmon/lm90.c
>> +++ b/drivers/hwmon/lm90.c
> 
> [ ... ]
> 
>> @@ -2739,18 +2744,17 @@ static int lm90_probe_channel_from_dt(struct i2c_client *client,
>>   	return 0;
>>   }
>>   
>> -static int lm90_parse_dt_channel_info(struct i2c_client *client,
>> -				      struct lm90_data *data)
>> +static int lm90_parse_channel_info(struct i2c_client *client,
>> +				   struct lm90_data *data)
>>   {
>>   	int err;
>>   	struct device *dev = &client->dev;
>> -	const struct device_node *np = dev->of_node;
>>   
>> -	for_each_child_of_node_scoped(np, child) {
>> -		if (strcmp(child->name, "channel"))
>> +	device_for_each_child_node_scoped(dev, child) {
>> +		if (!fwnode_name_eq(child, "channel"))
> 
> [Severity: Critical]
> This is a pre-existing issue, but switching to
> device_for_each_child_node_scoped() exposes this driver to a regression
> in the core fwnode_get_next_child_node() framework.
> 

Interesting report, and quite possibly valid, but not caused
by this driver.

Guenter