Re: Make checkpatch warn about pointless casting of kalloc returns.

2007-08-13 Thread Andy Whitcroft
jschopp wrote: >> +# 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: > >

Re: Make checkpatch warn about pointless casting of kalloc returns.

2007-08-13 Thread Andy Whitcroft
jschopp wrote: +# 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

Re: Make checkpatch warn about pointless casting of kalloc returns.

2007-08-08 Thread Nish Aravamudan
On 8/8/07, jschopp <[EMAIL PROTECTED]> wrote: > > > > +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

Re: Make checkpatch warn about pointless casting of kalloc returns.

2007-08-08 Thread jschopp
> > +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. I'm open to suggestions.. How about WARN("No need to

Re: Make checkpatch warn about pointless casting of kalloc returns.

2007-08-08 Thread Cal Peake
On Wed, 8 Aug 2007, Dave Jones wrote: > > I haven't tried it but how about something like: > > > > if($rawline =~/\(.*\)\s*k[czm]alloc/){ > > Hmm, could even just drop the check for the '*' > )[ ]k.. should be good enough. There is none, both the '*'s are qualifiers :) > > which if I got

Re: Make checkpatch warn about pointless casting of kalloc returns.

2007-08-08 Thread Dave Jones
On Wed, Aug 08, 2007 at 12:05:13PM -0500, jschopp wrote: > > +# 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); >

Re: Make checkpatch warn about pointless casting of kalloc returns.

2007-08-08 Thread jschopp
+# 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

Re: Make checkpatch warn about pointless casting of kalloc returns.

2007-08-08 Thread jschopp
+# 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

Re: Make checkpatch warn about pointless casting of kalloc returns.

2007-08-08 Thread Dave Jones
On Wed, Aug 08, 2007 at 12:05:13PM -0500, jschopp wrote: +# 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

Re: Make checkpatch warn about pointless casting of kalloc returns.

2007-08-08 Thread Cal Peake
On Wed, 8 Aug 2007, Dave Jones wrote: I haven't tried it but how about something like: if($rawline =~/\(.*\)\s*k[czm]alloc/){ Hmm, could even just drop the check for the '*' )[ ]k.. should be good enough. There is none, both the '*'s are qualifiers :) which if I got it right

Re: Make checkpatch warn about pointless casting of kalloc returns.

2007-08-08 Thread jschopp
+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. I'm open to suggestions.. How about WARN(No need to cast

Re: Make checkpatch warn about pointless casting of kalloc returns.

2007-08-08 Thread Nish Aravamudan
On 8/8/07, jschopp [EMAIL PROTECTED] wrote: +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. I'm

Make checkpatch warn about pointless casting of kalloc returns.

2007-08-07 Thread Dave Jones
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 p

Make checkpatch warn about pointless casting of kalloc returns.

2007-08-07 Thread Dave Jones
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