linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dave Jones <davej@redhat.com>
To: apw@shadowen.org
Cc: rdunlap@xenotime.net, jschopp@austin.ibm.com,
	Linux Kernel <linux-kernel@vger.kernel.org>
Subject: Make checkpatch warn about pointless casting of kalloc returns.
Date: Tue, 7 Aug 2007 22:43:21 -0400	[thread overview]
Message-ID: <20070808024321.GA6316@redhat.com> (raw)

Make checkpatch warn about pointless casting of kalloc returns.

Signed-off-by: Dave Jones <davej@redhat.com>

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

             reply	other threads:[~2007-08-08  2:45 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-08-08  2:43 Dave Jones [this message]
2007-08-08 17:05 ` Make checkpatch warn about pointless casting of kalloc returns jschopp
2007-08-08 18:00   ` Dave Jones
2007-08-08 18:10     ` Cal Peake
2007-08-08 18:27     ` jschopp
2007-08-08 18:40       ` Nish Aravamudan
2007-08-13 10:24   ` Andy Whitcroft

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20070808024321.GA6316@redhat.com \
    --to=davej@redhat.com \
    --cc=apw@shadowen.org \
    --cc=jschopp@austin.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rdunlap@xenotime.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).