Skip to contentSkip to conversation

scripts/kernel-doc: fix empty function description section

PATCH New Randy Dunlap 1 participant 1 message Mar 8, 2010

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 scripts/kernel-doc: fix empty function description section

From: Randy Dunlap <[email protected]>

scripts/kernel-doc mishandles a function that has a multi-line function short description and no function parameters. The observed problem was from drivers/scsi/scsi_netlink.c:

/**
* scsi_netlink_init - Called by SCSI subsystem to intialize
* the SCSI transport netlink interface
*
**/

kernel-doc treated the " * " line as a Description: section with only a newline character in the Description contents. This caused output_highlight() to complain:
output_highlight got called with no args?
plus produce a perl call stack backtrace.

The fix is just to ignore Description sections if they only contain "\n".

---
 scripts/kernel-doc |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/kernel-doc +1 -1
@@ -2105,7 +2105,7 @@ sub process_file($) {
 		$section = $newsection;
 	    } elsif (/$doc_end/) {
 
-		if ($contents ne "") {
+		if (($contents ne "") && ($contents ne "\n")) {
 		    dump_section($file, $section, xml_escape($contents));
 		    $section = $section_default;
 		    $contents = "";