dtc: dt-check-style: Right strip whitespaces, leftovers before comments

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@oss.qualcomm.com>
Link: https://patch.msgid.link/20260915-b4-dts-style-checker-continued-lines-v4-5-5b8e09b11ef2@oss.qualcomm.com
Signed-off-by: Rob Herring (Arm) <robh@kernel.org>
This commit is contained in:
Krzysztof Kozlowski 2026-09-15 19:03:49 +02:00 committed by Rob Herring (Arm)
parent c6138ed5ce
commit 897e4c0de6

View File

@ -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 = []