mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: jschopp <jschopp@austin.ibm.com>
To: Dave Jones <davej@redhat.com>,
	apw@shadowen.org, rdunlap@xenotime.net, jschopp@austin.ibm.com,
	Linux Kernel <linux-kernel@vger.kernel.org>
Subject: Re: Make checkpatch warn about pointless casting of kalloc returns.
Date: Wed, 08 Aug 2007 12:05:13 -0500	[thread overview]
Message-ID: <46B9F7C9.9060406@austin.ibm.com> (raw)
In-Reply-To: <20070808024321.GA6316@redhat.com>

> +# check for pointless casting of kmalloc return
> +		if ($rawline =~ /\*\)[ ]k[czm]alloc/) {

It looks to me like this will catch

foo = (char *) kmalloc(512);

but not

for = (char* )kmalloc(512);

I haven't tried it but how about something like:

if($rawline =~/\(.*\)\s*k[czm]alloc/){

which if I got it right should match the typecast with any combination of spacing.

> +			WARN("No need to cast return value.\n");

Could the warning be more descriptive?  This describes what, but it should also describe 
why; after all if somebody made this error they may not know they why.

  reply	other threads:[~2007-08-08 17:06 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-08-08  2:43 Dave Jones
2007-08-08 17:05 ` jschopp [this message]
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=46B9F7C9.9060406@austin.ibm.com \
    --to=jschopp@austin.ibm.com \
    --cc=apw@shadowen.org \
    --cc=davej@redhat.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

Powered by JetHome