[U-Boot] [PATCH 1/1] USB: Fix strict aliasing in ohci-hcd
Marek Vasut
marex at denx.de
Tue Aug 14 19:33:29 CEST 2012
Dear Troy Kisky,
> commit 5f6aa03fda2a0a79940765865c1e4266be8a75f8
> USB: Fix complaints about strict aliasing in OHCI-HCD
>
> tried to fix this, but gcc4.4 still complains. So, this
> patch basically reverts the above and does a simpler fix.
>
> also, the above commit incorrectly changed
> /* corresponds to data_buf[4-7] */
> datab [1] = 0;
> to
>
> /* corresponds to databuf.u8[4-7] */
> databuf.u8[1] = 0;
>
> This patch also fixes that.
>
> Signed-off-by: Troy Kisky <troy.kisky at boundarydevices.com>
> ---
> drivers/usb/host/ohci-hcd.c | 70
> +++++++++++++++++++------------------------ 1 file changed, 31
> insertions(+), 39 deletions(-)
>
> diff --git a/drivers/usb/host/ohci-hcd.c b/drivers/usb/host/ohci-hcd.c
> index d24f2f1..9f47351 100644
> --- a/drivers/usb/host/ohci-hcd.c
> +++ b/drivers/usb/host/ohci-hcd.c
> @@ -1261,19 +1261,11 @@ static int ohci_submit_rh_msg(struct usb_device
> *dev, unsigned long pipe, int leni = transfer_len;
> int len = 0;
> int stat = 0;
> - __u32 datab[4];
> - union {
> - void *ptr;
> - __u8 *u8;
> - __u16 *u16;
> - __u32 *u32;
> - } databuf;
> __u16 bmRType_bReq;
> __u16 wValue;
> __u16 wIndex;
> __u16 wLength;
> -
> - databuf.u32 = (__u32 *)datab;
> + ALLOC_ALIGN_BUFFER(__u8, databuf, 16, sizeof(u32));
Ok, pardon my sloppiness in reviews ... but why not alloc this cache aligned?
That way we'd also circumvent the issues with caches we'd eventually hit anyway.
[...]
The rest is OK.
More information about the U-Boot
mailing list