Linux USB
 help / color / mirror / Atom feed
From: Rob Herring <robh@kernel.org>
To: Chen-Yu Tsai <wenst@chromium.org>
Cc: sashiko-reviews@lists.linux.dev, linux-usb@vger.kernel.org,
	devicetree@vger.kernel.org, linux-amlogic@lists.infradead.org,
	imx@lists.linux.dev, conor+dt@kernel.org, Frank.Li@kernel.org,
	neil.armstrong@linaro.org
Subject: Re: [PATCH 1/2] dt-bindings: usb: hcd: Add downstream USB ports
Date: Fri, 30 Oct 2026 10:04:35 -0500	[thread overview]
Message-ID: <20261030150435.GA3992442-robh@kernel.org> (raw)
In-Reply-To: <CAGXv+5EuYc3iEpwNDNX+Sa2QXnPNe_C0HHH1PCy+j2vyV88xuA@mail.gmail.com>

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@kernel.org> wrote:
> >
> > Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
> > - [Medium] dt-bindings: usb: port@0 schema constraint bypassed
> > --
> >
> > commit aaa6107663f4d524c266c3a18264c416a86a4bb4
> > Author: Chen-Yu Tsai <wenst@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@0 from passing validation?
> >
> > Since JSON schema patternProperties only restrict matching nodes, a
> > non-matching node like port@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@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@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

  reply	other threads:[~2026-10-30 15:04 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-14  8:20 [PATCH 0/2] dt-bindings: usb: downstream host ports for hcd and dwc3 Chen-Yu Tsai
2026-10-14  8:20 ` [PATCH 1/2] dt-bindings: usb: hcd: Add downstream USB ports Chen-Yu Tsai
2026-10-14  8:31   ` sashiko-bot
2026-10-14 10:16     ` Chen-Yu Tsai
2026-10-30 15:04       ` Rob Herring [this message]
2026-10-14  8:20 ` [PATCH 2/2] dt-bindings: usb: snps,dwc3: Fix downstream port numbering Chen-Yu Tsai
2026-10-14  8:28   ` Neil Armstrong
2026-10-14  9:29     ` Chen-Yu Tsai
2026-10-14  9:44       ` Neil Armstrong
2026-10-14 10:14         ` Chen-Yu Tsai
2026-10-14 12:15           ` Neil Armstrong
2026-10-14 16:36         ` Konrad Dybcio
2026-10-15  7:44           ` Neil Armstrong
2026-10-15  9:00             ` Chen-Yu Tsai
2026-10-21  9:44               ` Konrad Dybcio
2026-10-30  7:28                 ` Chen-Yu Tsai
2026-10-14  8:31   ` sashiko-bot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261030150435.GA3992442-robh@kernel.org \
    --to=robh@kernel.org \
    --cc=Frank.Li@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=imx@lists.linux.dev \
    --cc=linux-amlogic@lists.infradead.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=neil.armstrong@linaro.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=wenst@chromium.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox