[PATCH 1/3] dtc: dt-check-style: Right strip whitespaces, leftovers before comments

From: Krzysztof Kozlowski

Date: Sun Sep 06 2026 - 14:05:00 EST


Stripping a comment from a line to get the code leads trailing
whitespace (e.g. in a line like "enable-active-high; /* comment */")
which will break DtsLine.code.endswith() checks.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@xxxxxxxxxxxxxxxx>
---
scripts/dtc/dt-check-style | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/scripts/dtc/dt-check-style b/scripts/dtc/dt-check-style
index 15a3ba82fd5f..dfa9d3687852 100755
--- a/scripts/dtc/dt-check-style
+++ b/scripts/dtc/dt-check-style
@@ -91,7 +91,8 @@ class DtsLine:
self.indent_str = indent_str # leading whitespace as-is
self.depth = depth
self.stripped = stripped # Code without indentation
- self.code = _strip_strings_and_comments(stripped) # Only the code, skipping trailing comments
+ # Only the code, skipping trailing comments and space between code and trailing comment
+ self.code = _strip_strings_and_comments(stripped).rstrip()
self.is_root = is_root
self.prop_name = None
self.continuations = []
--
2.53.0