Make checkpatch warn about pointless casting of kalloc returns.

From: Dave Jones
Date: Tue Aug 07 2007 - 22:45:30 EST


Make checkpatch warn about pointless casting of kalloc returns.

Signed-off-by: Dave Jones <davej@xxxxxxxxxx>

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 73751ab..c6cae6a 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -1051,6 +1051,11 @@ sub process {
CHK("__setup appears un-documented -- check Documentation/kernel-parameters.txt\n" . $herecurr);
}
}
+
+# check for pointless casting of kmalloc return
+ if ($rawline =~ /\*\)[ ]k[czm]alloc/) {
+ WARN("No need to cast return value.\n");
+ }
}

if ($chk_patch && !$is_patch) {
--
http://www.codemonkey.org.uk
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/