Skip to contentSkip to conversation

checkpatch-warn-when-missing-newline-in-return-sysfs_emit-formats.patch removed from -mm tree

merged [email protected] 1 participant 1 message May 8, 2021

lore
Share & tools
lore

[email protected]

author tree notice Applied
#0 lore raw

The patch titled
Subject: checkpatch: warn when missing newline in return sysfs_emit() formats
has been removed from the -mm tree. Its filename was
checkpatch-warn-when-missing-newline-in-return-sysfs_emit-formats.patch

This patch was dropped because it was merged into mainline or a subsystem tree

------------------------------------------------------
From: Joe Perches <[email protected]>
Subject: checkpatch: warn when missing newline in return sysfs_emit() formats

return sysfs_emit() uses should include a newline.

Suggest adding a newline when one is missing. Add one using --fix too.

---

 scripts/checkpatch.pl |   11 +++++++++++
 1 file changed, 11 insertions(+)
scripts/checkpatch.pl renamed from scripts/checkpatch.pl~checkpatch-warn-when-missing-newline-in-return-sysfs_emit-formats +11 -0
@@ -7198,6 +7198,17 @@ sub process {
 			     "Using $1 should generally have parentheses around the comparison\n" . $herecurr);
 		}
 
+# return sysfs_emit(foo, fmt, ...) fmt without newline
+		if ($line =~ /\breturn\s+sysfs_emit\s*\(\s*$FuncArg\s*,\s*($String)/ &&
+		    substr($rawline, $-[6], $+[6] - $-[6]) !~ /\\n"$/) {
+			my $offset = $+[6] - 1;
+			if (WARN("SYSFS_EMIT",
+				 "return sysfs_emit(...) formats should include a terminating newline\n" . $herecurr) &&
+			    $fix) {
+				substr($fixed[$fixlinenr], $offset, 0) = '\\n';
+			}
+		}
+
 # nested likely/unlikely calls
 		if ($line =~ /\b(?:(?:un)?likely)\s*\(\s*!?\s*(IS_ERR(?:_OR_NULL|_VALUE)?|WARN)/) {
 			WARN("LIKELY_MISUSE",

_

Patches currently in -mm which might be from [email protected] are