[PATCH 6/6] staging: vc04_services: Add casts to remove warnings in vchiq_core.c
Eric Anholt
eric at anholt.net
Thu Oct 20 10:09:52 PDT 2016
Michael Zoran <mzoran at crowfest.net> writes:
> On Wed, 2016-10-19 at 09:24 -0700, Eric Anholt wrote:
>> Michael Zoran <mzoran at crowfest.net> writes:
>>
>> Oh, interesting note that the warnings weren't actual issues (since
>> they
>> all get ANDed with a mask, or are about ints-cast-as-pointers).
>>
>
> Actually, there are real issues. I should have mentioned that in the
> description.
>
>> > } else {
>> > - int payload[2] = { (int)bulk->data, bulk->size };
>> > + int payload[2] = { (int)(long)bulk->data, bulk-
>> > >size
>> > };
>>
>> In these last two, I don't think you need the "(int)" casts, but
>> either
>> way is fine with me.
>>
>
> The cast is actually needed here. This payload packet is a message
> that gets sent directly to the GPU/Firmware. So the length of it
> can't be easily changed.
>
> The reason it's OK, to have the int cast is because that data is in the
> DMA region. On the BCM2835, this is always a 32-bit address( only 1 GB
> of RAM is currently supported), so it is OK to cast it to a 32 bit
> number.
I think the (int) doesn't change the compiler's behavior here, either in
code emitted or warnings emitted (64-bit longs will get implicitly cast
down to 32-bit ints on store without complaint). Still, I'm fine either
way.
> Ideally, I would like the GPU/Firmware to change to remove issues like
> this but I think that's outside the scope of this patch series.
Agreed.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 800 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-rpi-kernel/attachments/20161020/138e737f/attachment.sig>
More information about the linux-rpi-kernel
mailing list