[U-Boot] ARM: cfi_flash: Fix unaligned accesses to cfi_qry structure

Marek Vasut marex at denx.de
Fri May 10 14:36:00 CEST 2013


Hello Masahiro-san,

> Dear Andrew Gabbasov,

This way of starting emails seems to be dangerously widely adopted ;-D

> Your patch seems to newly generate the following warning and error,
> because your patch is changing the type of 'qry->max_buf_write_size' from
> u16 to u8[2].
> 
> > cfi_flash.c:2038:33: warning: comparison between pointer and integer
> > [enabled by default] cfi_flash.c:2046:27: error: incompatible types when
> > assigning to type 'u8[2]' from type 'int'

Good find.

> By the way, I also had this unalignment access problem for my board.
> Before finding your patch, I was thinking another way to fix this problem.
> 
> My idea is to just use 'get_unaligned' and 'put_unaligned' functions
> instead of introducing special macros.
> With this way, we don't need to change the fields of struct cfi_qry.

I think we should make sure to use natural alignment as much as possible, 
really. I'm keeping Albert in CC because this is his turf.

> If you fix the above problem, I think your patch will be fine.
> But I am wondering which way is more smart.
> 
> Best regards,
> Masahiro Yamada

[...]

Best regards,
Marek Vasut


More information about the U-Boot mailing list