Re: [PATCH v4 3/4] dt-bindings: hwmon: (pmbus/max20830): add max20830c and max20840c support

[email protected] Tue, 28 Jul 2026 03:38:41 +0000
Newsgroups org.kernel.vger.linux-hwmon,org.kernel.vger.linux-devicetree
Message-ID <[email protected]>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] The device tree fallback compatible `adi,max20830` for `adi,max20840c` is broken in practice because the `max20830` driver explicitly rejects the MAX20840C hardware ID.
--

--- Patch [3]: [PATCH v4 3/4] dt-bindings: hwmon: (pmbus/max20830): add max20830c and max20840c support ---
commit c98fae7fd69f878845956d0f0458ff6045d86d9d
Author: Alexis Czezar Torreno <[email protected]>

dt-bindings: hwmon: (pmbus/max20830): add max20830c and max20840c support

This commit adds compatible strings for MAX20830C and MAX20840C variants,
using the existing adi,max20830 compatible string as a fallback.

> diff --git a/Documentation/devicetree/bindings/hwmon/pmbus/adi,max20830.yaml b/Documentation/devicetree/bindings/hwmon/pmbus/adi,max20830.yaml
> index 01b7275f5b341..cc50a4ee44a27 100644
> --- a/Documentation/devicetree/bindings/hwmon/pmbus/adi,max20830.yaml
> +++ b/Documentation/devicetree/bindings/hwmon/pmbus/adi,max20830.yaml
> @@ -22,7 +22,13 @@ allOf:
>  
>  properties:
>    compatible:
> -    const: adi,max20830
> +    oneOf:
> +      - const: adi,max20830
> +      - items:
> +          - enum:
> +              - adi,max20830c
> +              - adi,max20840c
> +          - const: adi,max20830

[Severity: Medium]
Does this fallback compatible actually work for the MAX20840C?

Looking at max20830_probe() in drivers/hwmon/pmbus/max20830.c, the driver
strictly compares the hardware ID to MAX20830:

drivers/hwmon/pmbus/max20830.c:max20830_probe() {
	...
	if (strncmp(buf, "MAX20830", MAX20830_IC_DEVICE_ID_LENGTH - 1))
		return dev_err_probe(&client->dev, -ENODEV,
				     "Unsupported device: '%s'\n", buf);
	...
}

Will an unmodified driver successfully probe the adi,max20840c device using
this fallback string, or will it fail the hardware ID check and return -ENODEV?

-- 
Sashiko AI review ยท https://sashiko.dev/#/patchset/[email protected]?part=3