[PATCH 1/2] schemas: i2c: Avoid extra characters in i2c nodename pattern

Herve Codina posted 2 patches 1 month, 1 week ago
There is a newer version of this series
[PATCH 1/2] schemas: i2c: Avoid extra characters in i2c nodename pattern
Posted by Herve Codina 1 month, 1 week ago
Current nodename pattern doesn't limit the end of name for an i2c node.
It can match 'i2c@10-foo'.

In order to avoid matching to an incorrect name, avoid any extra
characters in nodename pattern.

Signed-off-by: Herve Codina <herve.codina@bootlin.com>
---
 dtschema/schemas/i2c/i2c-controller.yaml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/dtschema/schemas/i2c/i2c-controller.yaml b/dtschema/schemas/i2c/i2c-controller.yaml
index 487e669..018d266 100644
--- a/dtschema/schemas/i2c/i2c-controller.yaml
+++ b/dtschema/schemas/i2c/i2c-controller.yaml
@@ -14,7 +14,7 @@ maintainers:
 
 properties:
   $nodename:
-    pattern: "^i2c(@.*)?"
+    pattern: "^i2c(@.*)?$"
 
   i2c-bus:
     type: object
-- 
2.49.0
Re: [PATCH 1/2] schemas: i2c: Avoid extra characters in i2c nodename pattern
Posted by Rob Herring 1 month, 1 week ago
On Tue, Apr 01, 2025 at 10:10:39AM +0200, Herve Codina wrote:
> Current nodename pattern doesn't limit the end of name for an i2c node.
> It can match 'i2c@10-foo'.
> 
> In order to avoid matching to an incorrect name, avoid any extra
> characters in nodename pattern.
> 
> Signed-off-by: Herve Codina <herve.codina@bootlin.com>
> ---
>  dtschema/schemas/i2c/i2c-controller.yaml | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Applied.