[PATCH 1/2] dt-bindings: usb: hcd: Add downstream USB ports
Rob Herring
robh at kernel.org
Fri Oct 30 08:04:35 PDT 2026
On Wed, Oct 14, 2026 at 07:16:51PM +0900, Chen-Yu Tsai wrote:
> On Wed, Oct 14, 2026 at 5:31 PM <sashiko-bot at kernel.org> wrote:
> >
> > Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
> > - [Medium] dt-bindings: usb: port at 0 schema constraint bypassed
> > --
> >
> > commit aaa6107663f4d524c266c3a18264c416a86a4bb4
> > Author: Chen-Yu Tsai <wenst at chromium.org>
> >
> > dt-bindings: usb: hcd: Add downstream USB ports
> >
> > This commit adds a "ports" child node to the USB HCD binding to support
> > connecting downstream USB connector nodes via OF graph. It attempts to enforce
> > that USB downstream port numbers start at 1, and updates the address matching
> > for hard-wired downstream devices.
> >
> > > diff --git a/Documentation/devicetree/bindings/usb/usb-hcd.yaml b/Documentation/devicetree/bindings/usb/usb-hcd.yaml
> > > index 45a19d4928afa..24df99dfb243c 100644
> > > --- a/Documentation/devicetree/bindings/usb/usb-hcd.yaml
> > > +++ b/Documentation/devicetree/bindings/usb/usb-hcd.yaml
> > > @@ -29,8 +29,16 @@ properties:
> > > "#size-cells":
> > > const: 0
> > >
> > > + ports:
> > > + $ref: /schemas/graph.yaml#/properties/ports
> > > + description: The downstream facing USB ports
> > > +
> > > + patternProperties:
> > > + "^port@[1-9a-f][0-9a-f]?$":
> > > + $ref: /schemas/graph.yaml#/properties/port
> >
> > [Severity: Medium]
> > Does this local constraint actually prevent port at 0 from passing validation?
> >
> > Since JSON schema patternProperties only restrict matching nodes, a
> > non-matching node like port at 0 will fall back to the generic graph.yaml
> > reference.
This is a common issue we have in graph and ethernet-switch schemas...
> > Because graph.yaml evaluates anything matching ^port(@.*)?$, wouldn't
> > port at 0 be evaluated as valid and silently pass, completely bypassing the
> > intent that downstream port numbers start at 1?
>
> I suspect I need to write it as:
>
> ports:
> properties:
> port at 0: false
> patternProperties:
> "^port@[1-9a-f][0-9a-f]?$": ...
You should just not restrict it here so schema is applied to any port
node and instead restrict the 'reg' values allowed.
Rob
More information about the linux-amlogic
mailing list