Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

docs: kdoc: remove dead code

create_parameter_list() tests an argument against the same regex twice, in
two different locations; remove the pointless extra tests and the
never-executed error cases that go with them.

Reviewed-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Signed-off-by: Jonathan Corbet <corbet@lwn.net>
Link: https://lore.kernel.org/r/20250814154035.328769-2-corbet@lwn.net

+6 -16
+6 -16
scripts/lib/kdoc/kdoc_parser.py
··· 564 564 args.insert(0, first_arg.pop()) 565 565 dtype = ' '.join(first_arg) 566 566 567 + bitfield_re = KernRe(r'(.*?):(\w+)') 567 568 for param in args: 568 - if KernRe(r'^(\*+)\s*(.*)').match(param): 569 - r = KernRe(r'^(\*+)\s*(.*)') 570 - if not r.match(param): 571 - self.emit_msg(ln, f"Invalid param: {param}") 572 - continue 573 - 574 - param = r.group(1) 575 - 569 + r = KernRe(r'^(\*+)\s*(.*)') 570 + if r.match(param): 576 571 self.push_parameter(ln, decl_type, r.group(2), 577 572 f"{dtype} {r.group(1)}", 578 573 arg, declaration_name) 579 574 580 - elif KernRe(r'(.*?):(\w+)').search(param): 581 - r = KernRe(r'(.*?):(\w+)') 582 - if not r.match(param): 583 - self.emit_msg(ln, f"Invalid param: {param}") 584 - continue 585 - 575 + elif bitfield_re.search(param): 586 576 if dtype != "": # Skip unnamed bit-fields 587 - self.push_parameter(ln, decl_type, r.group(1), 588 - f"{dtype}:{r.group(2)}", 577 + self.push_parameter(ln, decl_type, bitfield_re.group(1), 578 + f"{dtype}:{bitfield_re.group(2)}", 589 579 arg, declaration_name) 590 580 else: 591 581 self.push_parameter(ln, decl_type, param, dtype,