Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] Schema validation conditional uses `const` instead of `contains: const`, bypassing requirements for compatible string arrays.
--
--- Patch [2]: [PATCH v2 2/2] dt-bindings: spi: ti,davinci-spi: convert to DT schema ---
commit d0abc65d99912b6ce06eea7206590c61cb52b6de
Author: Bhargav Joshi <[email protected]>
dt-bindings: spi: ti,davinci-spi: convert to DT schema
This commit converts the TI DaVinci/Keystone SPI controller binding from text
format to DT schema. It creates a separate schema for peripheral properties,
adds missing DMA properties, and introduces constraints to the ti,spi-wdelay
property.
> diff --git a/Documentation/devicetree/bindings/spi/ti,davinci-spi.yaml b/Documentation/devicetree/bindings/spi/ti,davinci-spi.yaml
> new file mode 100644
> index 0000000000000..b685082de721c
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/spi/ti,davinci-spi.yaml
[ ... ]
> +required:
> + - compatible
> + - reg
> + - interrupts
> + - clocks
> + - ti,davinci-spi-intr-line
> +
> +allOf:
> + - $ref: spi-controller.yaml#
> + - if:
> + properties:
> + compatible:
> + const: ti,keystone-spi
[Severity: Medium]
Should this use contains: const instead of just const?
Because dt-schema evaluates this strictly based on JSON Schema rules, an array
value will not match the scalar const. As a result, when the compatible
property is an array, this conditional is bypassed.
This allows device tree configurations to silently pass dt_binding_check even
if they erroneously omit the mandatory power-domains property.
> + then:
> + required:
> + - power-domains
> +
> +unevaluatedProperties: false
> +
> +examples:
> + - |
> + spi@20bf0000 {
> + compatible = "ti,keystone-spi","ti,dm6441-spi";
> + reg = <0x20bf0000 0x1000>;
> + num-cs = <4>;
> + ti,davinci-spi-intr-line = <0>;
> + interrupts = <338>;
> + clocks = <&clkspi>;
> + #address-cells = <1>;
> + #size-cells = <0>;
Does the lack of contains: const explain why this example passes validation
despite omitting the power-domains property?
[ ... ]
--
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=2
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.