Re: [PATCH v12 1/2] dt-bindings: leds: Add LTC3220 18 channel LED Driver

[email protected]
Newsgroups org.kernel.vger.linux-leds,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] Invalid JSON schema constraints on the `reg` property inside `patternProperties`.
--

commit 70a03b6b56cf5d4bab2e86c90bde0b112ebfaa81
Author: Edelweise Escala <[email protected]>

dt-bindings: leds: Add LTC3220 18 channel LED Driver

LTC3220 is a multi-display LED driver with I2C interface.
The LTC3220 provides individual brightness control (64-step),
blinking, and gradation features for up to 18 LED outputs.

> diff --git a/Documentation/devicetree/bindings/leds/adi,ltc3220.yaml b/Documentation/devicetree/bindings/leds/adi,ltc3220.yaml
> new file mode 100644
> index 0000000000000..c859490e9108e
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/leds/adi,ltc3220.yaml

[ ... ]

> +patternProperties:
> +  '^led@([1-9a-f]|1[0-2])$':
> +    type: object
> +    $ref: /schemas/leds/common.yaml#
> +    unevaluatedProperties: false
> +    properties:
> +      reg:
> +        description:
> +          Output channel for the LED (1-18 maps to LED outputs D1-D18).
> +          Unit-address must be in hexadecimal (1-12 hex = 1-18 decimal).
> +          For aggregated LED control, define only one LED node with reg = <0x1>
> +          and use led-sources to list all controlled outputs. Only reg 1 should
> +          be present when using led-sources.
> +        minimum: 1
> +        maximum: 18

[Severity: Medium]
Since the reg property is parsed by dt-schema as a uint32-matrix (an array of
arrays), do these scalar minimum and maximum constraints actually apply?

JSON Schema silently ignores numeric constraints when applied to an array,
meaning this might not provide the intended validation for the unit-address.

> +
> +    required:
> +      - reg
> +
> +    if:
> +      required:
> +        - led-sources
> +    then:
> +      properties:
> +        reg:
> +          const: 1

[Severity: Medium]
Will this const constraint fail validation against the array [[1]] during
make dt_binding_check?

Because dt-schema's automated fixups do not recursively patch constraints
inside if-then conditional blocks, this strict equality check for a scalar
integer might cause false-positive failures for device trees using the
'Aggregated LED' configuration with led-sources and reg = <0x1> (including
the example provided at the bottom of this binding).

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.