public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH 1/2] Fix warnings in arch/arm/cpu/arm920t/s3c24x0/usb_ohci.c
@ 2011-11-16  4:17 Simon Glass
  2011-11-16  4:17 ` [U-Boot] [PATCH 2/2] Fix warnings in yaffs Simon Glass
                   ` (2 more replies)
  0 siblings, 3 replies; 14+ messages in thread
From: Simon Glass @ 2011-11-16  4:17 UTC (permalink / raw)
  To: u-boot

Sorry if this is already fixed somewhere - I could not find it.

This fixes these warnings:

usb_ohci.c: In function 'submit_control_msg':
usb_ohci.c:1081: warning: dereferencing pointer 'data_buf.76' does break strict-aliasing rules
usb_ohci.c:1081: note: initialized from here
usb_ohci.c:1084: warning: dereferencing pointer 'data_buf.76' does break strict-aliasing rules
usb_ohci.c:1084: note: initialized from here
usb_ohci.c:1087: warning: dereferencing pointer 'data_buf.76' does break strict-aliasing rules
usb_ohci.c:1087: note: initialized from here

Signed-off-by: Simon Glass <sjg@chromium.org>
---
 arch/arm/cpu/arm920t/s3c24x0/usb_ohci.c |   20 ++++++++++++--------
 1 files changed, 12 insertions(+), 8 deletions(-)

diff --git a/arch/arm/cpu/arm920t/s3c24x0/usb_ohci.c b/arch/arm/cpu/arm920t/s3c24x0/usb_ohci.c
index 263d2ce..80bb61b27 100644
--- a/arch/arm/cpu/arm920t/s3c24x0/usb_ohci.c
+++ b/arch/arm/cpu/arm920t/s3c24x0/usb_ohci.c
@@ -1041,8 +1041,12 @@ 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 *data_buf = (__u8 *) datab;
+	union {
+		__u32 word[4];
+		__u16 hword[8];
+		__u8 byte[16];
+	} datab;
+	__u8 *data_buf = datab.byte;
 	__u16 bmRType_bReq;
 	__u16 wValue;
 	__u16 wIndex;
@@ -1078,20 +1082,20 @@ static int ohci_submit_rh_msg(struct usb_device *dev, unsigned long pipe,
 		 */
 
 	case RH_GET_STATUS:
-		*(__u16 *) data_buf = m16_swap(1);
+		datab.hword[0] = m16_swap(1);
 		OK(2);
 	case RH_GET_STATUS | RH_INTERFACE:
-		*(__u16 *) data_buf = m16_swap(0);
+		datab.hword[0] = m16_swap(0);
 		OK(2);
 	case RH_GET_STATUS | RH_ENDPOINT:
-		*(__u16 *) data_buf = m16_swap(0);
+		datab.hword[0] = m16_swap(0);
 		OK(2);
 	case RH_GET_STATUS | RH_CLASS:
-		*(__u32 *) data_buf =
+		datab.word[0] =
 		    m32_swap(RD_RH_STAT & ~(RH_HS_CRWE | RH_HS_DRWE));
 		OK(4);
 	case RH_GET_STATUS | RH_OTHER | RH_CLASS:
-		*(__u32 *) data_buf = m32_swap(RD_RH_PORTSTAT);
+		datab.word[0] = m32_swap(RD_RH_PORTSTAT);
 		OK(4);
 
 	case RH_CLEAR_FEATURE | RH_ENDPOINT:
@@ -1223,7 +1227,7 @@ static int ohci_submit_rh_msg(struct usb_device *dev, unsigned long pipe,
 				data_buf[3] |= 0x8;
 
 			/* corresponds to data_buf[4-7] */
-			datab[1] = 0;
+			datab.word[1] = 0;
 			data_buf[5] = (temp & RH_A_POTPGT) >> 24;
 			temp = roothub_b(&gohci);
 			data_buf[7] = temp & RH_B_DR;
-- 
1.7.3.1

^ permalink raw reply related	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2011-12-09  9:33 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-11-16  4:17 [U-Boot] [PATCH 1/2] Fix warnings in arch/arm/cpu/arm920t/s3c24x0/usb_ohci.c Simon Glass
2011-11-16  4:17 ` [U-Boot] [PATCH 2/2] Fix warnings in yaffs Simon Glass
2011-11-16 20:39   ` Wolfgang Denk
2011-11-16 21:38   ` Mike Frysinger
2011-11-16 21:50     ` Simon Glass
2011-11-16 16:03 ` [U-Boot] [PATCH 1/2] Fix warnings in arch/arm/cpu/arm920t/s3c24x0/usb_ohci.c Mike Frysinger
2011-11-16 21:16   ` Simon Glass
2011-11-16 21:37     ` Mike Frysinger
2011-11-18  2:35       ` Marek Vasut
2011-11-18 22:47         ` Simon Glass
2011-12-02 16:33           ` Simon Glass
2011-12-02 16:53             ` Stefano Babic
2011-12-02 17:02               ` Simon Glass
2011-12-09  9:33 ` Wolfgang Denk

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox