]> www.infradead.org Git - users/willy/linux.git/commitdiff
docs: kdoc: straighten up dump_declaration()
authorJonathan Corbet <corbet@lwn.net>
Wed, 2 Jul 2025 19:34:40 +0000 (13:34 -0600)
committerJonathan Corbet <corbet@lwn.net>
Tue, 15 Jul 2025 19:43:30 +0000 (13:43 -0600)
Get rid of the excess "return" statements in dump_declaration(), along with
a line of never-executed dead code.

Reviewed-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Signed-off-by: Jonathan Corbet <corbet@lwn.net>
scripts/lib/kdoc/kdoc_parser.py

index 6e35e508608b9043f16b7355eb0db3f22c0d406e..7191fa94e17ab0872d79e30a948dac4352b13844 100644 (file)
@@ -878,18 +878,13 @@ class KernelDoc:
 
         if self.entry.decl_type == "enum":
             self.dump_enum(ln, prototype)
-            return
-
-        if self.entry.decl_type == "typedef":
+        elif self.entry.decl_type == "typedef":
             self.dump_typedef(ln, prototype)
-            return
-
-        if self.entry.decl_type in ["union", "struct"]:
+        elif self.entry.decl_type in ["union", "struct"]:
             self.dump_struct(ln, prototype)
-            return
-
-        self.output_declaration(self.entry.decl_type, prototype,
-                                entry=self.entry)
+        else:
+            # This would be a bug
+            self.emit_message(ln, f'Unknown declaration type: {self.entry.decl_type}')
 
     def dump_function(self, ln, prototype):
         """