Re: [PATCH v3 06/11] dtc: dt-check-style: Fix alignment of values in continued property lines

Krzysztof Kozlowski <[email protected]> Wed, 5 Aug 2026 09:12:06 +0200
Newsgroups dev.linux.lists.sashiko-reviews,org.kernel.vger.linux-devicetree
Message-ID <20260805-quantum-impossible-sparrow-619791@quoll>
On Mon, Aug 03, 2026 at 09:21:40AM +0000, [email protected] wrote:
> Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
> - [Low] The dt-check-style continuation alignment heuristic misaligns C preprocessor macros
> --
> 
> --- Patch [6]: [PATCH v3 06/11] dtc: dt-check-style: Fix alignment of values in continued property lines ---
> commit 2e7f6260952152a0c0c19383e03e859b1a3c8092
> Author: Krzysztof Kozlowski <[email protected]>
> 
> dtc: dt-check-style: Fix alignment of values in continued property lines
> 
> This commit updates the dt-check-style script to enforce proper alignment
> for continued property lines. If a continued line is part of a previous
> phandle, it requires alignment to inner values rather than the opening
> bracket to improve readability.
> 
> > diff --git a/scripts/dtc/dt-check-style b/scripts/dtc/dt-check-style
> > index bdf36ba9e2744..1c67348fb5269 100755
> > --- a/scripts/dtc/dt-check-style
> > +++ b/scripts/dtc/dt-check-style
> 
> [ ... ]
> 
> > @@ -942,15 +943,20 @@ def check_continuation_alignment(ctx):
> >              continue
> >          # First '<' or '"' after '='
> >          rest = dl.raw[eq + 1:]
> > -        m = re.search(r'[<"]', rest)
> > +        m = re.search(r'\s*([<"])', rest)
> >          if not m:
> >              continue
> > -        target_col = _display_col(dl.raw[:eq + 1 + m.start()])
> > +        target_col = _display_col(dl.raw[:eq + 1 + m.start(1)])
> >          for cont in dl.continuations:
> > -            if _display_col(cont.indent_str) != target_col:
> > +            target_offset = 0
> > +            err_msg_explanation = 'to < or "'
> > +            if not re.match(r'[<"]', cont.stripped):
> > +                target_offset = 1
> 
> [Severity: Low]
> Does this heuristic unintentionally force misalignment for C preprocessor macros
> when they appear as top-level elements in comma-separated property lists?
> 
> Looking at check_continuation_alignment() in scripts/dtc/dt-check-style, if a
> macro is used in a list alongside <...> elements:
> 
> clocks = <&foo>,
>          CLOCK_MACRO;

We don't want code like this... but comment is valid. The check should
rather rely on ending of the previous phandle.

Best regards,
Krzysztof