* [PATCH 1/2] dt-bindings: rockchip: pmu: Narrow definition of reboot-mode
@ 2026-07-01 10:58 Krzysztof Kozlowski
2026-07-01 10:58 ` [PATCH 2/2] dt-bindings: rockchip: grf: Narrow allowed reboot modes Krzysztof Kozlowski
2026-07-01 19:55 ` [PATCH 1/2] dt-bindings: rockchip: pmu: Narrow definition of reboot-mode Rob Herring (Arm)
0 siblings, 2 replies; 6+ messages in thread
From: Krzysztof Kozlowski @ 2026-07-01 10:58 UTC (permalink / raw)
To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Heiko Stuebner,
Elaine Zhang, devicetree, linux-arm-kernel, linux-rockchip,
linux-kernel
Cc: Krzysztof Kozlowski
The 'reboot-mode' child of PMU node must be a syscon-reboot-mode one, so
add missing $ref to enforce the validation and disallow other
reboot-mode handlers.
Defining 'type: object' is on the other hand not necessary when other
schema is referenced.
This can be further restricted to match hardware/firmware:
syscon-reboot-mode schema allows arbitrary "mode-.* properties but only
a subset actually makes sense and is valid. Provide negative look-ahead
pattern to disallow any modes not supported by the device, which
tightens the binding.
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>
---
Documentation/devicetree/bindings/arm/rockchip/pmu.yaml | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/Documentation/devicetree/bindings/arm/rockchip/pmu.yaml b/Documentation/devicetree/bindings/arm/rockchip/pmu.yaml
index 55b2200d6e75..1cff2328cd01 100644
--- a/Documentation/devicetree/bindings/arm/rockchip/pmu.yaml
+++ b/Documentation/devicetree/bindings/arm/rockchip/pmu.yaml
@@ -61,7 +61,13 @@ properties:
type: object
reboot-mode:
- type: object
+ $ref: /schemas/power/reset/syscon-reboot-mode.yaml
+ unevaluatedProperties: false
+
+ patternProperties:
+ # Negative look-ahead to disallow unsupported modes. The '$' has to be
+ # part of lookahead group to work, instead of trailing outside of ().
+ "^mode-(?!(bootloader$|loader$|normal$|recovery$))": false
required:
- compatible
--
2.53.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 2/2] dt-bindings: rockchip: grf: Narrow allowed reboot modes
2026-07-01 10:58 [PATCH 1/2] dt-bindings: rockchip: pmu: Narrow definition of reboot-mode Krzysztof Kozlowski
@ 2026-07-01 10:58 ` Krzysztof Kozlowski
2026-07-01 11:10 ` sashiko-bot
2026-07-01 19:56 ` Rob Herring (Arm)
2026-07-01 19:55 ` [PATCH 1/2] dt-bindings: rockchip: pmu: Narrow definition of reboot-mode Rob Herring (Arm)
1 sibling, 2 replies; 6+ messages in thread
From: Krzysztof Kozlowski @ 2026-07-01 10:58 UTC (permalink / raw)
To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Heiko Stuebner,
Elaine Zhang, devicetree, linux-arm-kernel, linux-rockchip,
linux-kernel
Cc: Krzysztof Kozlowski
syscon-reboot-mode schema allows arbitrary "mode-.* properties but only
a subset actually makes sense and is valid. Provide negative look-ahead
pattern to disallow any modes not supported by the device, which
tightens the binding.
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>
---
Documentation/devicetree/bindings/soc/rockchip/grf.yaml | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/Documentation/devicetree/bindings/soc/rockchip/grf.yaml b/Documentation/devicetree/bindings/soc/rockchip/grf.yaml
index 2cc43742b8e3..7bcb4e2f47ec 100644
--- a/Documentation/devicetree/bindings/soc/rockchip/grf.yaml
+++ b/Documentation/devicetree/bindings/soc/rockchip/grf.yaml
@@ -239,11 +239,14 @@ allOf:
properties:
reboot-mode:
type: object
-
$ref: /schemas/power/reset/syscon-reboot-mode.yaml#
-
unevaluatedProperties: false
+ patternProperties:
+ # Negative look-ahead to disallow unsupported modes. The '$' has to be
+ # part of lookahead group to work, instead of trailing outside of ().
+ "^mode-(?!(bootloader$|fastboot$|loader$|normal$|recovery$))": false
+
- if:
properties:
compatible:
--
2.53.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 2/2] dt-bindings: rockchip: grf: Narrow allowed reboot modes
2026-07-01 10:58 ` [PATCH 2/2] dt-bindings: rockchip: grf: Narrow allowed reboot modes Krzysztof Kozlowski
@ 2026-07-01 11:10 ` sashiko-bot
2026-07-01 11:19 ` Krzysztof Kozlowski
2026-07-01 19:56 ` Rob Herring (Arm)
1 sibling, 1 reply; 6+ messages in thread
From: sashiko-bot @ 2026-07-01 11:10 UTC (permalink / raw)
To: Krzysztof Kozlowski; +Cc: conor+dt, devicetree, robh
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] The patch introduces a new `patternProperties` constraint to tighten the `reboot-mode` schema, but places it inside a conditional `if` block that does not enumerate all relevant Rockchip platforms. Platforms such as `rockchip,rk3328-grf`, `rockchip,rk3562-pmu-grf`, `rockchip,rk3066-grf`, and `rockchip,rk3188-grf` use `reboot-mode` in their device trees but are missing from this `if` condition. As a result, they bypass the block entirely and evade the newly introduced constraint, making the schema tightening incomplete.
--
commit 16c4d82cda45faacd19f46f2d3336cc68b841769
Author: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>
dt-bindings: rockchip: grf: Narrow allowed reboot modes
syscon-reboot-mode schema allows arbitrary "mode-.* properties but only
a subset actually makes sense and is valid. Provide negative look-ahead
pattern to disallow any modes not supported by the device, which
tightens the binding.
> diff --git a/Documentation/devicetree/bindings/soc/rockchip/grf.yaml b/Documentation/devicetree/bindings/soc/rockchip/grf.yaml
> index 2cc43742b8e3b..7bcb4e2f47ec5 100644
> --- a/Documentation/devicetree/bindings/soc/rockchip/grf.yaml
> +++ b/Documentation/devicetree/bindings/soc/rockchip/grf.yaml
> @@ -239,11 +239,14 @@ allOf:
> properties:
> reboot-mode:
> type: object
> -
> $ref: /schemas/power/reset/syscon-reboot-mode.yaml#
> -
> unevaluatedProperties: false
>
> + patternProperties:
> + # Negative look-ahead to disallow unsupported modes. The '$' has to be
> + # part of lookahead group to work, instead of trailing outside of ().
> + "^mode-(?!(bootloader$|fastboot$|loader$|normal$|recovery$))": false
> +
[Severity: Medium]
Looking at the surrounding code, this constraint is added inside a conditional
block that only enumerates a subset of platforms:
- if:
properties:
compatible:
contains:
enum:
- rockchip,px30-pmugrf
- rockchip,rk3036-grf
- rockchip,rk3308-grf
- rockchip,rk3368-pmugrf
- rockchip,rv1103b-pmu-grf
Does this leave the schema tightening incomplete? Other platforms such as
rockchip,rk3328-grf, rockchip,rk3562-pmu-grf, rockchip,rk3066-grf, and
rockchip,rk3188-grf also use reboot-mode in their device trees.
Since they are missing from this conditional, will their reboot-mode
properties silently evade the new patternProperties validation?
> - if:
> properties:
> compatible:
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260701105849.197086-3-krzysztof.kozlowski@oss.qualcomm.com?part=2
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 2/2] dt-bindings: rockchip: grf: Narrow allowed reboot modes
2026-07-01 11:10 ` sashiko-bot
@ 2026-07-01 11:19 ` Krzysztof Kozlowski
0 siblings, 0 replies; 6+ messages in thread
From: Krzysztof Kozlowski @ 2026-07-01 11:19 UTC (permalink / raw)
To: sashiko-reviews; +Cc: conor+dt, devicetree, robh
On 01/07/2026 13:10, sashiko-bot@kernel.org wrote:
> Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
> - [Medium] The patch introduces a new `patternProperties` constraint to tighten the `reboot-mode` schema, but places it inside a conditional `if` block that does not enumerate all relevant Rockchip platforms. Platforms such as `rockchip,rk3328-grf`, `rockchip,rk3562-pmu-grf`, `rockchip,rk3066-grf`, and `rockchip,rk3188-grf` use `reboot-mode` in their device trees but are missing from this `if` condition. As a result, they bypass the block entirely and evade the newly introduced constraint, making the schema tightening incomplete.
> --
False positive, additional restriction is placed in exact place which
allows reboot-mode.
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 1/2] dt-bindings: rockchip: pmu: Narrow definition of reboot-mode
2026-07-01 10:58 [PATCH 1/2] dt-bindings: rockchip: pmu: Narrow definition of reboot-mode Krzysztof Kozlowski
2026-07-01 10:58 ` [PATCH 2/2] dt-bindings: rockchip: grf: Narrow allowed reboot modes Krzysztof Kozlowski
@ 2026-07-01 19:55 ` Rob Herring (Arm)
1 sibling, 0 replies; 6+ messages in thread
From: Rob Herring (Arm) @ 2026-07-01 19:55 UTC (permalink / raw)
To: Krzysztof Kozlowski
Cc: Krzysztof Kozlowski, linux-kernel, Conor Dooley, Heiko Stuebner,
linux-arm-kernel, linux-rockchip, devicetree, Elaine Zhang
On Wed, 01 Jul 2026 12:58:50 +0200, Krzysztof Kozlowski wrote:
> The 'reboot-mode' child of PMU node must be a syscon-reboot-mode one, so
> add missing $ref to enforce the validation and disallow other
> reboot-mode handlers.
> Defining 'type: object' is on the other hand not necessary when other
> schema is referenced.
>
> This can be further restricted to match hardware/firmware:
> syscon-reboot-mode schema allows arbitrary "mode-.* properties but only
> a subset actually makes sense and is valid. Provide negative look-ahead
> pattern to disallow any modes not supported by the device, which
> tightens the binding.
>
> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>
> ---
> Documentation/devicetree/bindings/arm/rockchip/pmu.yaml | 8 +++++++-
> 1 file changed, 7 insertions(+), 1 deletion(-)
>
Acked-by: Rob Herring (Arm) <robh@kernel.org>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 2/2] dt-bindings: rockchip: grf: Narrow allowed reboot modes
2026-07-01 10:58 ` [PATCH 2/2] dt-bindings: rockchip: grf: Narrow allowed reboot modes Krzysztof Kozlowski
2026-07-01 11:10 ` sashiko-bot
@ 2026-07-01 19:56 ` Rob Herring (Arm)
1 sibling, 0 replies; 6+ messages in thread
From: Rob Herring (Arm) @ 2026-07-01 19:56 UTC (permalink / raw)
To: Krzysztof Kozlowski
Cc: devicetree, linux-rockchip, Krzysztof Kozlowski, linux-kernel,
Conor Dooley, linux-arm-kernel, Heiko Stuebner, Elaine Zhang
On Wed, 01 Jul 2026 12:58:51 +0200, Krzysztof Kozlowski wrote:
> syscon-reboot-mode schema allows arbitrary "mode-.* properties but only
> a subset actually makes sense and is valid. Provide negative look-ahead
> pattern to disallow any modes not supported by the device, which
> tightens the binding.
>
> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>
> ---
> Documentation/devicetree/bindings/soc/rockchip/grf.yaml | 7 +++++--
> 1 file changed, 5 insertions(+), 2 deletions(-)
>
Acked-by: Rob Herring (Arm) <robh@kernel.org>
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2026-07-01 19:56 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-01 10:58 [PATCH 1/2] dt-bindings: rockchip: pmu: Narrow definition of reboot-mode Krzysztof Kozlowski
2026-07-01 10:58 ` [PATCH 2/2] dt-bindings: rockchip: grf: Narrow allowed reboot modes Krzysztof Kozlowski
2026-07-01 11:10 ` sashiko-bot
2026-07-01 11:19 ` Krzysztof Kozlowski
2026-07-01 19:56 ` Rob Herring (Arm)
2026-07-01 19:55 ` [PATCH 1/2] dt-bindings: rockchip: pmu: Narrow definition of reboot-mode Rob Herring (Arm)
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox