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)));
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
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
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