diff mbox

[U-Boot,3/4] USB: Fix anti-aliasing complaints in OHCI-HCD

Message ID 1313846925-31212-3-git-send-email-marek.vasut@gmail.com
State Changes Requested
Headers show

Commit Message

Marek Vasut Aug. 20, 2011, 1:28 p.m. UTC
Signed-off-by: Marek Vasut <marek.vasut@gmail.com>
---
 drivers/usb/host/ohci-hcd.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

Comments

Marek Vasut Aug. 20, 2011, 1:34 p.m. UTC | #1
On Saturday, August 20, 2011 03:28:43 PM Marek Vasut wrote:
> Signed-off-by: Marek Vasut <marek.vasut@gmail.com>

Dang, I mistyped Remy's address ... fixed.

> ---
>  drivers/usb/host/ohci-hcd.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/usb/host/ohci-hcd.c b/drivers/usb/host/ohci-hcd.c
> index bc8bb20..dcd8fc8 100644
> --- a/drivers/usb/host/ohci-hcd.c
> +++ b/drivers/usb/host/ohci-hcd.c
> @@ -1262,7 +1262,7 @@ 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];
> +	__u8 datab[16] __attribute__((aligned(4)));
>  	__u8 *data_buf = (__u8 *)datab;
>  	__u16 bmRType_bReq;
>  	__u16 wValue;
Mike Frysinger Aug. 20, 2011, 6:07 p.m. UTC | #2
On Saturday, August 20, 2011 09:28:43 Marek Vasut wrote:
> -	__u32 datab[4];
> +	__u8 datab[16] __attribute__((aligned(4)));
>  	__u8 *data_buf = (__u8 *)datab;

leverage a union to avoid attributes:
union {
	__u32 u32[4];
	__u8 u8[16];
} datab;
__u8 *data_buf = datab.u8;

also, it isn't "anti-aliasing complaints", it's "fix strict aliasing 
violations".  "anti-aliasing" is something completely different in the 
computing world :p.
-mike
Marek Vasut Aug. 20, 2011, 6:56 p.m. UTC | #3
On Saturday, August 20, 2011 08:07:49 PM Mike Frysinger wrote:
> On Saturday, August 20, 2011 09:28:43 Marek Vasut wrote:
> > -	__u32 datab[4];
> > +	__u8 datab[16] __attribute__((aligned(4)));
> > 
> >  	__u8 *data_buf = (__u8 *)datab;
> 
> leverage a union to avoid attributes:
> union {
> 	__u32 u32[4];
> 	__u8 u8[16];
> } datab;
> __u8 *data_buf = datab.u8;
> 
> also, it isn't "anti-aliasing complaints", it's "fix strict aliasing
> violations".  "anti-aliasing" is something completely different in the
> computing world :p.

Well I guess my brain just saw the compiler output differently ... thanks for the 
catch.

> -mike
diff mbox

Patch

diff --git a/drivers/usb/host/ohci-hcd.c b/drivers/usb/host/ohci-hcd.c
index bc8bb20..dcd8fc8 100644
--- a/drivers/usb/host/ohci-hcd.c
+++ b/drivers/usb/host/ohci-hcd.c
@@ -1262,7 +1262,7 @@  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];
+	__u8 datab[16] __attribute__((aligned(4)));
 	__u8 *data_buf = (__u8 *)datab;
 	__u16 bmRType_bReq;
 	__u16 wValue;