public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* checkpatch bug: space between left parenthesis and asterisk
@ 2007-10-30 19:27 Timur Tabi
  2007-10-30 19:54 ` Zach Brown
  2007-10-30 21:46 ` Andy Whitcroft
  0 siblings, 2 replies; 4+ messages in thread
From: Timur Tabi @ 2007-10-30 19:27 UTC (permalink / raw)
  To: apw, linux-kernel

I'm running checkpatch.pl (dated 10/17), and it complains about this line:

crc = __be32_to_cpu(* ((__be32 *) ((void *) firmware + calc_size)));

the message I get is:

ERROR: need space before that '*' (ctx:BxW)
#721: FILE: arch/powerpc/sysdev/qe_lib/qe.c:527:
+       crc = __be32_to_cpu(* ((__be32 *) ((void *) firmware + calc_size)));
                             ^

so I add a space, and now I get this:

ERROR: no space after that open parenthesis '('
#721: FILE: arch/powerpc/sysdev/qe_lib/qe.c:527:
+       crc = __be32_to_cpu( * ((__be32 *) ((void *) firmware + calc_size)));


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: checkpatch bug: space between left parenthesis and asterisk
  2007-10-30 19:27 checkpatch bug: space between left parenthesis and asterisk Timur Tabi
@ 2007-10-30 19:54 ` Zach Brown
  2007-10-30 20:02   ` Timur Tabi
  2007-10-30 21:46 ` Andy Whitcroft
  1 sibling, 1 reply; 4+ messages in thread
From: Zach Brown @ 2007-10-30 19:54 UTC (permalink / raw)
  To: Timur Tabi; +Cc: apw, linux-kernel

Timur Tabi wrote:
> I'm running checkpatch.pl (dated 10/17), and it complains about this line:
> 
> crc = __be32_to_cpu(* ((__be32 *) ((void *) firmware + calc_size)));

Well, that is a bit of a stinker.  Maybe it could be reworked a little
to make it easier for humans and checkpatch to understand?

  __be32 *crazy_pointer = (void *)firmware + calc_size;
  crc = be32_to_cpu(*crazy_pointer);

(Does this need to worry about get_unaligned() at all?)

- z

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: checkpatch bug: space between left parenthesis and asterisk
  2007-10-30 19:54 ` Zach Brown
@ 2007-10-30 20:02   ` Timur Tabi
  0 siblings, 0 replies; 4+ messages in thread
From: Timur Tabi @ 2007-10-30 20:02 UTC (permalink / raw)
  To: Zach Brown; +Cc: apw, linux-kernel

Zach Brown wrote:
> Timur Tabi wrote:
>> I'm running checkpatch.pl (dated 10/17), and it complains about this line:
>>
>> crc = __be32_to_cpu(* ((__be32 *) ((void *) firmware + calc_size)));
> 
> Well, that is a bit of a stinker.  Maybe it could be reworked a little
> to make it easier for humans and checkpatch to understand?
> 
>   __be32 *crazy_pointer = (void *)firmware + calc_size;
>   crc = be32_to_cpu(*crazy_pointer);

I admit the code might be convoluted, but it's perfectly valid, and it 
eliminates the need for "crazy_pointer".  I'm much more inclined to ignore
the checkpatch error than to redesign my code.

Besides, your argument is a bit of a strawman.  The real problem is with checkpatch.

> (Does this need to worry about get_unaligned() at all?)

Well, I suppose it's technically possible, but only if my data has been corrupted.

-- 
Timur Tabi
Linux kernel developer at Freescale

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: checkpatch bug: space between left parenthesis and asterisk
  2007-10-30 19:27 checkpatch bug: space between left parenthesis and asterisk Timur Tabi
  2007-10-30 19:54 ` Zach Brown
@ 2007-10-30 21:46 ` Andy Whitcroft
  1 sibling, 0 replies; 4+ messages in thread
From: Andy Whitcroft @ 2007-10-30 21:46 UTC (permalink / raw)
  To: Timur Tabi; +Cc: linux-kernel

On Tue, Oct 30, 2007 at 02:27:13PM -0500, Timur Tabi wrote:
> I'm running checkpatch.pl (dated 10/17), and it complains about this line:
> 
> crc = __be32_to_cpu(* ((__be32 *) ((void *) firmware + calc_size)));
> 
> the message I get is:
> 
> ERROR: need space before that '*' (ctx:BxW)
> #721: FILE: arch/powerpc/sysdev/qe_lib/qe.c:527:
> +       crc = __be32_to_cpu(* ((__be32 *) ((void *) firmware + calc_size)));

Hmmm, i've looked back a couple of releases and this seems to get
reported correctly.  Removing this space is then silent.

ERROR: no space after that '*' (ctx:BxW)
#4: FILE: Z31.c:1:
+       crc = __be32_to_cpu(* ((__be32 *) ((void *) firmware + calc_size)));

What version is checkpatch reported as?  Also can I have the entire diff
hunk this is from in case its being caused by the context, though that
seems unlikely.

Thanks.

-apw

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2007-10-30 21:47 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-10-30 19:27 checkpatch bug: space between left parenthesis and asterisk Timur Tabi
2007-10-30 19:54 ` Zach Brown
2007-10-30 20:02   ` Timur Tabi
2007-10-30 21:46 ` Andy Whitcroft

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox