]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
docs: kdoc_parser: fix the default_value logic for variables
authorMauro Carvalho Chehab <mchehab+huawei@kernel.org>
Mon, 2 Mar 2026 16:40:49 +0000 (17:40 +0100)
committerJonathan Corbet <corbet@lwn.net>
Tue, 3 Mar 2026 17:47:24 +0000 (10:47 -0700)
The indentation is wrong for the second regex, which causes
problems on variables with defaults.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Acked-by: Randy Dunlap <rdunlap@infradead.org>
Tested-by: Randy Dunlap <rdunlap@infradead.org>
Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
Signed-off-by: Jonathan Corbet <corbet@lwn.net>
Message-ID: <681f18338abd6ae33cb9c15d72bb31a1cba75a9a.1772469446.git.mchehab+huawei@kernel.org>

tools/lib/python/kdoc/kdoc_parser.py

index 9c9443281c407271ee44c3b8a4f6875985719f50..4bf55244870f2cb7c7cb317e72ab97d1a7648f5c 100644 (file)
@@ -1027,9 +1027,9 @@ class KernelDoc:
             default_val = r.group(2)
         else:
             r= KernRe(OPTIONAL_VAR_ATTR + r"(?:[\w_]*)?\s+(?:\*+)?(?:[\w_]+)\s*[\d\]\[]*\s*(=.*)?")
-        if r.match(proto):
-            default_val = r.group(1)
 
+            if r.match(proto):
+                default_val = r.group(1)
         if not declaration_name:
            self.emit_msg(ln,f"{proto}: can't parse variable")
            return