Re: [PATCH 3/9] dtc: dt-check-style: Handle root node in overlays
Krzysztof Kozlowski <[email protected]> Sat, 1 Aug 2026 19:43:50 +0200
| Newsgroups | dev.linux.lists.sashiko-reviews,org.kernel.vger.linux-devicetree |
|---|---|
| Message-ID | <[email protected]> |
On 26/07/2026 18:00, [email protected] wrote: >> diff --git a/scripts/dtc/dt-check-style b/scripts/dtc/dt-check-style >> --- a/scripts/dtc/dt-check-style >> +++ b/scripts/dtc/dt-check-style > > [ ... ] > >> @@ -228,7 +229,10 @@ def classify_lines(text): >> continue >> >> if code.endswith('{'): >> - dl = DtsLine(i, raw, LineType.NODE_OPEN, depth, indent_str, code) >> + is_root = False >> + if code == '&{/} {' or code == '/ {': > > [Severity: Medium] > Will this exact string match handle valid alternative spacings or labels? > For example, if the code contains a label like "label: / {" or extra We don't label root node, but I will add a test for that. > whitespace like "/ {", it seems this would fail to set is_root to True. I'll add a test for that. > >> + is_root = True >> + dl = DtsLine(i, raw, LineType.NODE_OPEN, depth, indent_str, code, is_root=is_root) >> parse_node_header(dl) >> out.append(dl) >> depth += 1 > > [ ... ] > >> @@ -550,7 +554,9 @@ def check_child_name_order(ctx): >> for c in children: >> if c.node_addr is not None: >> continue >> - if c.node_name in (None, '/'): >> + if c.node_name is None: >> + continue >> + if c.is_root: > > [Severity: Medium] > Since this replaces the previous check for c.node_name in (None, '/'), could > it cause valid root nodes that were missed by the exact string match in > classify_lines() to incorrectly bypass this skip logic and trigger false > positives? is_root is added, so false positive. Best regards, Krzysztof