]> www.infradead.org Git - users/willy/linux.git/commitdiff
docs: kdoc: remove the brcount floor in process_proto_type()
authorJonathan Corbet <corbet@lwn.net>
Mon, 30 Jun 2025 16:03:28 +0000 (10:03 -0600)
committerJonathan Corbet <corbet@lwn.net>
Mon, 30 Jun 2025 16:03:28 +0000 (10:03 -0600)
Putting the floor under brcount does not change the output in any way, just
remove it.

Change the termination test from ==0 to <=0 to prevent infinite loops in
case somebody does something truly wacko in the code.

Signed-off-by: Jonathan Corbet <corbet@lwn.net>
scripts/lib/kdoc/kdoc_parser.py

index d9ff2d0661609836565bc9edb77f8955061b294e..935f2a3c4b478053cfe29b7d4847c646c06cdab6 100644 (file)
@@ -1609,9 +1609,7 @@ class KernelDoc:
                 self.entry.brcount += r.group(2).count('{')
                 self.entry.brcount -= r.group(2).count('}')
 
-                self.entry.brcount = max(self.entry.brcount, 0)
-
-                if r.group(2) == ';' and self.entry.brcount == 0:
+                if r.group(2) == ';' and self.entry.brcount <= 0:
                     self.dump_declaration(ln, self.entry.prototype)
                     self.reset_state(ln)
                     break