[U-Boot] [PATCH] display_buffer: fix misaligned buffer

Reinhard Meyer u-boot at emk-elektronik.de
Mon Aug 30 13:04:52 CEST 2010


Albert ARIBAUD schrieb:
> Le 30/08/2010 12:31, Stefano Babic a écrit :
>> Detlev Zundel wrote:
>>> Hi Reinhard,
>>>
>> Hi Reinhard, hi Detlev,
>>
>>>> should make the buffer an union:
>>>>
>>>> union {
>>>> 	uint32_t ui[MAX.../4+1];
>>>> 	uint16_t us[MAX.../2+1];
>>>> 	uint8_t  uc[MAX...+1];
>>>> } linebuf;
>>> That also sounds good indeed - it even better documents the intention of
>>> the code so by my own arguments I'd vote for it.  I presume you will
>>> follow up with such a patch once you tested it?
>> I agree this is a better solution as adding a simple comment. Some time
>> a comment is valid only at the time of the writing, and further patches
>> could drop its meaning if the comment is not updated, too.
> 
> Do we have to pick one? I say the code should use union *and* a one-line 
> comment should mention how the union enforces the alignment requirement.

I will do that. Test only on ARM9. Others must try to compile and see no
other arch gives warnings.

Reinhard



More information about the U-Boot mailing list