Re: [PATCH 1/3] dt-bindings: arm: coresight: restrict single port subnodes

From: Rob Herring
Date: Fri Dec 08 2023 - 15:24:42 EST


On Wed, Dec 06, 2023 at 12:53:30PM +0100, Krzysztof Kozlowski wrote:
> "in-ports" and "out-ports" with single "port" subnode should use
> "additionalProperties: false" to disallow any other properties mentioned
> by graph schema which are not applicable for this case, e.g.
> "address-cells".

The graph schema should already check this case with this subschema:

oneOf:
- required:
- port
- required:
- "#address-cells"
- "#size-cells"

However, I now see this would allow port and #address-cells if
#size-cells is omitted. (#address-cells is a dependency for
##size-cells, but not vice-versa because interrupt-controllers can have
##just #address-cells). Perhaps this should instead be:

oneOf:
- required:
- port
- anyOf:
- required:
- "#address-cells"
- required:
- "#size-cells"

We're missing a similar check on endpoint. Or I'm forgetting why I
didn't add it.

I suspect there are a lot more cases if we fixed these in the users.

Rob