Linux-PHY Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Marek Vasut" <marex@nabladev.com>
Cc: devicetree@vger.kernel.org, linux-phy@lists.infradead.org,
	vkoul@kernel.org, neil.armstrong@linaro.org, robh@kernel.org,
	olteanv@gmail.com, conor+dt@kernel.org
Subject: Re: [PATCH v3 7/9] dt-bindings: arm: stm32: Switch st,stm32mp23/25-syscfg into simple-mfd
Date: Sat, 22 Aug 2026 08:01:03 +0000	[thread overview]
Message-ID: <20260822080103.AC78A1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260822074816.548662-8-marex@nabladev.com>

Thank you for your contribution! Sashiko AI review found 4 potential issue(s) to consider:
- [Critical] Strictly enforcing `simple-mfd` in the compatible array breaks backward compatibility with existing device trees.
- [High] The `en_refcnt` atomic reference counter is leaked on error paths in `stm32_usb2phy_enable()`, permanently breaking the PHY.
- [Medium] The `allOf:if` condition for `st,stm32mp23/25-syscfg` uses `enum` directly on the `compatible` property array, bypassing the validation block.
- [Low] The `patternProperties` regex in the syscon parent binding rejects the `usb-phy@` node name recommended by the child PHY binding.
--

--- Patch [7]: [PATCH v3 7/9] dt-bindings: arm: stm32: Switch st,stm32mp23/25-syscfg into simple-mfd ---
commit 4dd8eb77acf0eb2b46ea02d08826b4d490de3fb4
Author: Marek Vasut <marex@nabladev.com>
dt-bindings: arm: stm32: Switch st,stm32mp23/25-syscfg into simple-mfd

This commit updates the STM32 syscon binding to convert the
st,stm32mp23-syscfg and st,stm32mp25-syscfg compatibles into "simple-mfd".
This allows the OS to automatically populate the subnodes for the USB 2.0
FEMTO-PHY.

> diff --git a/Documentation/devicetree/bindings/arm/stm32/st,stm32-syscon.yaml b/Documentation/devicetree/bindings/arm/stm32/st,stm32-syscon.yaml
> index 95d2319afe235..4db4198c5dd7a 100644
> --- a/Documentation/devicetree/bindings/arm/stm32/st,stm32-syscon.yaml
> +++ b/Documentation/devicetree/bindings/arm/stm32/st,stm32-syscon.yaml
> @@ -22,11 +22,12 @@ properties:
>                - st,stm32mp151-pwr-mcu
>                - st,stm32mp157-syscfg
>                - st,stm32mp21-syscfg
> -              - st,stm32mp23-syscfg
> -              - st,stm32mp25-syscfg
>            - const: syscon
>        - items:
> -          - const: st,stm32-tamp
> +          - enum:
> +              - st,stm32-tamp
> +              - st,stm32mp23-syscfg
> +              - st,stm32mp25-syscfg
> +          - const: syscon
> +          - const: simple-mfd

[Severity: Critical]
Does enforcing simple-mfd in this array break backward compatibility?

Older device trees define these syscfg nodes using only st,stm32mp25-syscfg
and syscon. Moving them into a strict 3-item list requiring simple-mfd
causes validation to fail for existing DTBs.

> @@ -39,6 +40,17 @@ properties:
>    "#clock-cells":
>      const: 0
>  
> +  "#address-cells":
> +    const: 1
> +
> +  "#size-cells":
> +    const: 1
> +
> +patternProperties:
> +  "^phy@[0-9a-f]+$":
> +    type: object
> +    $ref: /schemas/phy/st,stm32-usb2phy.yaml

[Severity: Low]
Will this regex reject the node names recommended by the child PHY binding?

The child binding example uses usb-phy@2400:

    usb-phy@2400 {
        compatible = "st,stm32mp25-usb2phy1";

which fails the stricter ^phy@[0-9a-f]+$ pattern defined here.

[ ... ]

> @@ -57,10 +69,14 @@ allOf:
>    - if:
>        properties:
>          compatible:
> -          const: st,stm32mp25-syscfg
> +          enum:
> +            - st,stm32mp23-syscfg
> +            - st,stm32mp25-syscfg

[Severity: Medium]
Does this conditional block bypass schema validation?

Applying enum directly to an array property checks if the array strictly
equals the scalar string, which always evaluates to false. Should this use
contains: enum: instead?

>      then:
>        required:
>          - "#clock-cells"
> +        - "#address-cells"
> +        - "#size-cells"

[Severity: High]
Is there a reference counter leak in stm32_usb2phy_enable() introduced
earlier in this series?

If an unsupported clock rate is detected, the function returns without
decrementing en_refcnt:

drivers/phy/st/phy-stm32-usb2phy.c:stm32_usb2phy_enable() {
    ...
    if (...)
        ...
    else
        return -EINVAL;
}

Additionally, the common error paths do not decrement en_refcnt after it
was incremented:

drivers/phy/st/phy-stm32-usb2phy.c:stm32_usb2phy_enable() {
    ...
error_regdis:
    regulator_disable(phy_dev->vdd33);

    return ret;
}

Future calls will see en_refcnt > 1 and return success immediately, leaving
the PHY disabled.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260822074816.548662-1-marex@nabladev.com?part=7

-- 
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy

  reply	other threads:[~2026-08-22  8:01 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-22  7:46 [PATCH v3 0/9] arm64: dts: phy: st: usb: Add STM32MP2 USB support Marek Vasut
2026-08-22  7:46 ` [PATCH v3 1/9] dt-bindings: phy: Document ST STM32MP25 USB2-FEMTO PHY Marek Vasut
2026-08-22  7:55   ` sashiko-bot
2026-08-27 12:54   ` Krzysztof Kozlowski
2026-08-27 14:53     ` Marek Vasut
2026-08-27 21:33       ` Krzysztof Kozlowski
2026-08-27 23:14         ` Marek Vasut
2026-08-28  6:37           ` Krzysztof Kozlowski
2026-08-28  9:11   ` Krzysztof Kozlowski
2026-08-22  7:46 ` [PATCH v3 2/9] phy: stm32: Add support for " Marek Vasut
2026-08-22  7:58   ` sashiko-bot
2026-08-24 13:17   ` Fabrice Gasnier
2026-08-24 14:53     ` Marek Vasut
2026-08-27 16:00   ` Vinod Koul
2026-08-27 16:52     ` Marek Vasut
2026-08-22  7:46 ` [PATCH v3 3/9] dt-bindings: usb: generic-ehci: Document access-controllers property Marek Vasut
2026-08-28  9:13   ` Krzysztof Kozlowski
2026-08-22  7:46 ` [PATCH v3 4/9] dt-bindings: usb: generic-ohci: " Marek Vasut
2026-08-22  7:46 ` [PATCH v3 5/9] dt-bindings: usb: dwc3: Document ST STM32MP2 DWC3 xHCI USB controller Marek Vasut
2026-08-27 12:59   ` Krzysztof Kozlowski
2026-08-27 14:56     ` Marek Vasut
2026-08-22  7:46 ` [PATCH v3 6/9] usb: dwc3: dwc3-generic-plat: Add ST STM32MP2 DWC3 xHCI USB controller glue Marek Vasut
2026-08-22  7:56   ` sashiko-bot
2026-08-22  7:46 ` [PATCH v3 7/9] dt-bindings: arm: stm32: Switch st,stm32mp23/25-syscfg into simple-mfd Marek Vasut
2026-08-22  8:01   ` sashiko-bot [this message]
2026-08-27 13:07   ` Krzysztof Kozlowski
2026-08-27 15:04     ` Marek Vasut
2026-08-27 21:35       ` Krzysztof Kozlowski
2026-08-28  1:03         ` Marek Vasut
2026-08-22  7:46 ` [PATCH v3 8/9] arm64: dts: st: Add USB nodes on stm32mp231 Marek Vasut
2026-08-22  8:07   ` sashiko-bot
2026-08-24 13:18   ` Fabrice Gasnier
2026-08-24 14:39     ` Marek Vasut
2026-08-22  7:46 ` [PATCH v3 9/9] arm64: dts: st: Add USB nodes on stm32mp251 Marek Vasut
2026-08-24 13:19   ` Fabrice Gasnier
2026-08-24 14:39     ` Marek Vasut
2026-08-28  9:15   ` Krzysztof Kozlowski

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=20260822080103.AC78A1F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=linux-phy@lists.infradead.org \
    --cc=marex@nabladev.com \
    --cc=neil.armstrong@linaro.org \
    --cc=olteanv@gmail.com \
    --cc=robh@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=vkoul@kernel.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