Make checkpatch warn about pointless casting of kalloc returns.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Make checkpatch warn about pointless casting of kalloc returns.

Signed-off-by: Dave Jones <[email protected]>

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 [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux