Skip to contentSkip to conversation

Fix warnings in arch/arm/cpu/arm920t/s3c24x0/usb_ohci.c

PATCH New Simon Glass 5 participants 14 messages Nov 16, 2011 – Dec 9, 2011 Arm (32-bit)

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 Fix warnings in arch/arm/cpu/arm920t/s3c24x0/usb_ohci.c

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

---
 arch/arm/cpu/arm920t/s3c24x0/usb_ohci.c |   20 ++++++++++++--------
 1 files changed, 12 insertions(+), 8 deletions(-)
arch/arm/cpu/arm920t/s3c24x0/usb_ohci.c +12 -8
index 263d2ce..80bb61b27 100644
@@ -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;
Signature · 1 line
1.7.3.1
#1 lore raw

PATCH 2/2 Fix warnings in yaffs

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

This fixes the warnings show below.

yaffs_tagscompat.c: In function 'yaffs_TagsCompatabilityReadChunkWithTagsFromNAND':
yaffs_tagscompat.c:151: warning: dereferencing pointer 'tu' does break strict-aliasing rules yaffs_tagscompat.c:150: warning: dereferencing pointer 'tu' does break strict-aliasing rules yaffs_tagscompat.c:149: warning: dereferencing pointer 'tu' does break strict-aliasing rules yaffs_tagscompat.c:148: warning: dereferencing pointer 'tu' does break strict-aliasing rules yaffs_tagscompat.c:147: warning: dereferencing pointer 'tu' does break strict-aliasing rules yaffs_tagscompat.c:146: warning: dereferencing pointer 'tu' does break strict-aliasing rules yaffs_tagscompat.c:145: warning: dereferencing pointer 'tu' does break strict-aliasing rules yaffs_tagscompat.c:144: warning: dereferencing pointer 'tu' does break strict-aliasing rules yaffs_tagscompat.c:141: note: initialized from here

---
 fs/yaffs2/yaffs_tagscompat.c |   15 +++++++--------
 1 files changed, 7 insertions(+), 8 deletions(-)
fs/yaffs2/yaffs_tagscompat.c +7 -8
index 70a8a8c..e872323 100644
@@ -136,9 +136,8 @@ static void yaffs_LoadTagsIntoSpare(yaffs_Spare * sparePtr,
 }
 
 static void yaffs_GetTagsFromSpare(yaffs_Device * dev, yaffs_Spare * sparePtr,
-				   yaffs_Tags * tagsPtr)
+				   yaffs_TagsUnion *tu)
 {
-	yaffs_TagsUnion *tu = (yaffs_TagsUnion *) tagsPtr;
 	int result;
 
 	tu->asBytes[0] = sparePtr->tagByte0;
@@ -150,7 +149,7 @@ static void yaffs_GetTagsFromSpare(yaffs_Device * dev, yaffs_Spare * sparePtr,
 	tu->asBytes[6] = sparePtr->tagByte6;
 	tu->asBytes[7] = sparePtr->tagByte7;
 
-	result = yaffs_CheckECCOnTags(tagsPtr);
+	result = yaffs_CheckECCOnTags(&tu->asTags);
 	if (result > 0) {
 		dev->tagsEccFixed++;
 	} else if (result < 0) {
@@ -437,7 +436,7 @@ int yaffs_TagsCompatabilityReadChunkWithTagsFromNAND(yaffs_Device * dev,
 {
 
 	yaffs_Spare spare;
-	yaffs_Tags tags;
+	yaffs_TagsUnion tags;
 	yaffs_ECCResult eccResult;
 
 	static yaffs_Spare spareFF;
@@ -467,10 +466,10 @@ int yaffs_TagsCompatabilityReadChunkWithTagsFromNAND(yaffs_Device * dev,
 			if (eTags->chunkUsed) {
 				yaffs_GetTagsFromSpare(dev, &spare, &tags);
 
-				eTags->objectId = tags.objectId;
-				eTags->chunkId = tags.chunkId;
-				eTags->byteCount = tags.byteCount;
-				eTags->serialNumber = tags.serialNumber;
+				eTags->objectId = tags.asTags.objectId;
+				eTags->chunkId = tags.asTags.chunkId;
+				eTags->byteCount = tags.asTags.byteCount;
+				eTags->serialNumber = tags.asTags.serialNumber;
 			}
 		}
 
Signature · 1 line
1.7.3.1
#2 lore raw

PATCH 2/2 Fix warnings in yaffs

Dear Simon Glass,

Quoted 15 lines · In message <[email protected]> you wrote:

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

This fixes the warnings show below.

yaffs_tagscompat.c: In function 'yaffs_TagsCompatabilityReadChunkWithTagsFromNAND':
yaffs_tagscompat.c:151: warning: dereferencing pointer 'tu' does break strict-aliasing rules yaffs_tagscompat.c:150: warning: dereferencing pointer 'tu' does break strict-aliasing rules yaffs_tagscompat.c:149: warning: dereferencing pointer 'tu' does break strict-aliasing rules yaffs_tagscompat.c:148: warning: dereferencing pointer 'tu' does break strict-aliasing rules yaffs_tagscompat.c:147: warning: dereferencing pointer 'tu' does break strict-aliasing rules yaffs_tagscompat.c:146: warning: dereferencing pointer 'tu' does break strict-aliasing rules yaffs_tagscompat.c:145: warning: dereferencing pointer 'tu' does break strict-aliasing rules yaffs_tagscompat.c:144: warning: dereferencing pointer 'tu' does break strict-aliasing rules yaffs_tagscompat.c:141: note: initialized from here

Quoted 4 lines
---
 fs/yaffs2/yaffs_tagscompat.c |   15 +++++++--------
 1 files changed, 7 insertions(+), 8 deletions(-)

Applied, thanks.

Best regards,

Wolfgang Denk

Signature · 7 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
But the only way of discovering the limits  of  the  possible  is  to
venture a little way past them into the impossible.
                         - _Profiles of the Future_ (1962; rev. 1973)
                  ``Hazards of Prophecy: The Failure of Imagination''
#3 lore raw

PATCH 2/2 Fix warnings in yaffs

In reply to Simon Glass
Quoted 3 lines · On Tuesday 15 November 2011 23:17:07 Simon Glass wrote:

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

This fixes the warnings show below.

can you bounce this to the yaffs maintainers too ?

http://stoneboat.aleph1.co.uk/cgi-bin/mailman/listinfo/yaffs
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20111116/c562c7ac/attachment.pgp

#4 lore raw

PATCH 2/2 Fix warnings in yaffs

Hi Mike,

Quoted 10 lines · Mike Frysinger
Quoted 3 lines · On Tuesday 15 November 2011 23:17:07 Simon Glass wrote:

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

This fixes the warnings show below.

can you bounce this to the yaffs maintainers too ?

http://stoneboat.aleph1.co.uk/cgi-bin/mailman/listinfo/yaffs
-mike

Have done so, thanks for the pointer. I couldn't find an entry in MAINTAINERS (Hi Charles!). The code has been completely re-styled for the Linux upstream effort so we should probably take a new drop one day when that is complete.

Regards,
Simon

#5 lore raw

PATCH 1/2 Fix warnings in arch/arm/cpu/arm920t/s3c24x0/usb_ohci.c

In reply to Simon Glass

arch/arm/cpu/arm920t/s3c24x0/usb_ohci.c static int ohci_submit_rh_msg(struct usb_device *dev, unsigned long pipe, · line 1049

Quoted 11 lines · On Tuesday 15 November 2011 23:17:06 Simon Glass wrote:
arch/arm/cpu/arm920t/s3c24x0/usb_ohci.c +6 -2
 
-	__u32 datab[4];
-	__u8 *data_buf = (__u8 *) datab;
+	union {
+		__u32 word[4];
+		__u16 hword[8];
+		__u8 byte[16];
+	} datab;
+	__u8 *data_buf = datab.byte;

i thought someone posted this fix to the list before. but maybe it was for a different controller. perhaps this code has been copied/pasted all over ... -mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20111116/00dc6e4c/attachment.pgp

#6 lore raw

PATCH 1/2 Fix warnings in arch/arm/cpu/arm920t/s3c24x0/usb_ohci.c

Hi Mike,

Quoted 4 lines · Mike Frysinger
Quoted 3 lines · On Tuesday 15 November 2011 23:17:06 Simon Glass wrote:
arch/arm/cpu/arm920t/s3c24x0/usb_ohci.c +0 -0
Quoted 13 lines
Quoted 8 lines

- ? ? __u32 datab[4];
- ? ? __u8 *data_buf = (__u8 *) datab;
+ ? ? union {
+ ? ? ? ? ? ? __u32 word[4];
+ ? ? ? ? ? ? __u16 hword[8];
+ ? ? ? ? ? ? __u8 byte[16];
+ ? ? } datab;
+ ? ? __u8 *data_buf = datab.byte;

i thought someone posted this fix to the list before. ?but maybe it was for a different controller. ?perhaps this code has been copied/pasted all over ... -mike

Yes I found Marek's patch to another file with the same name, and much of the same code :-( But I don't think we currently have a patch for this file. It issues warnings in about 10 ARM builds from memory.

Regards,
Simon

#7 lore raw

PATCH 1/2 Fix warnings in arch/arm/cpu/arm920t/s3c24x0/usb_ohci.c

Quoted 18 lines · On Wednesday 16 November 2011 16:16:49 Simon Glass wrote:
Quoted 4 lines · Mike Frysinger
Quoted 3 lines · On Tuesday 15 November 2011 23:17:06 Simon Glass wrote:
arch/arm/cpu/arm920t/s3c24x0/usb_ohci.c +0 -0
Quoted 12 lines

arch/arm/cpu/arm920t/s3c24x0/usb_ohci.c static int ohci_submit_rh_msg(struct usb_device *dev, unsigned long pipe, · line 1049

Quoted 8 lines
arch/arm/cpu/arm920t/s3c24x0/usb_ohci.c +6 -2
-     __u32 datab[4];
-     __u8 *data_buf = (__u8 *) datab;
+     union {
+             __u32 word[4];
+             __u16 hword[8];
+             __u8 byte[16];
+     } datab;
+     __u8 *data_buf = datab.byte;

i thought someone posted this fix to the list before. but maybe it was for a different controller. perhaps this code has been copied/pasted all over ... -mike

Quoted 3 lines

Yes I found Marek's patch to another file with the same name, and much of the same code :-( But I don't think we currently have a patch for this file. It issues warnings in about 10 ARM builds from memory.

np. i know much of the u-boot arm tree (like Linux) has crappy cross-SoC integration.

-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20111116/69a6d558/attachment-0001.pgp

#8 lore raw

PATCH 1/2 Fix warnings in arch/arm/cpu/arm920t/s3c24x0/usb_ohci.c

Quoted 23 lines · On Wednesday 16 November 2011 16:16:49 Simon Glass wrote:
Quoted 18 lines · Mike Frysinger
Quoted 16 lines · On Tuesday 15 November 2011 23:17:06 Simon Glass wrote:

arch/arm/cpu/arm920t/s3c24x0/usb_ohci.c static int ohci_submit_rh_msg(struct usb_device *dev, unsigned long pipe, · line 1049

Quoted 11 lines
arch/arm/cpu/arm920t/s3c24x0/usb_ohci.c +6 -2
 
-     __u32 datab[4];
-     __u8 *data_buf = (__u8 *) datab;
+     union {
+             __u32 word[4];
+             __u16 hword[8];
+             __u8 byte[16];
+     } datab;
+     __u8 *data_buf = datab.byte;

i thought someone posted this fix to the list before. but maybe it was for a different controller. perhaps this code has been copied/pasted all over ... -mike

Quoted 3 lines

Yes I found Marek's patch to another file with the same name, and much of the same code :-( But I don't think we currently have a patch for this file. It issues warnings in about 10 ARM builds from memory.

Quoted 5 lines

np. i know much of the u-boot arm tree (like Linux) has crappy cross-SoC integration.

-mike

Well it kinda looks like this OHCI is copy of the drivers/usb/host/ohci-hcd.c ?

M

#9 lore raw

PATCH 1/2 Fix warnings in arch/arm/cpu/arm920t/s3c24x0/usb_ohci.c

Hi Marek,

Quoted 23 lines · Marek Vasut
Quoted 23 lines · On Wednesday 16 November 2011 16:16:49 Simon Glass wrote:
Quoted 21 lines · Mike Frysinger
Quoted 16 lines · On Tuesday 15 November 2011 23:17:06 Simon Glass wrote:

arch/arm/cpu/arm920t/s3c24x0/usb_ohci.c

Quoted 11 lines
arch/arm/cpu/arm920t/s3c24x0/usb_ohci.c +6 -2
 
- ? ? __u32 datab[4];
- ? ? __u8 *data_buf = (__u8 *) datab;
+ ? ? union {
+ ? ? ? ? ? ? __u32 word[4];
+ ? ? ? ? ? ? __u16 hword[8];
+ ? ? ? ? ? ? __u8 byte[16];
+ ? ? } datab;
+ ? ? __u8 *data_buf = datab.byte;

i thought someone posted this fix to the list before. ?but maybe it was for a different controller. ?perhaps this code has been copied/pasted all over ... -mike

Yes I found Marek's patch to another file with the same name, and much of the same code :-( But I don't think we currently have a patch for this file. It issues warnings in about 10 ARM builds from memory.

Quoted 7 lines
Quoted 5 lines

np. ?i know much of the u-boot arm tree (like Linux) has crappy cross-SoC integration.

-mike

Well it kinda looks like this OHCI is copy of the drivers/usb/host/ohci-hcd.c ?

Yes it is. We really need to push back harder on this sort of thing...

Regards,
Simon

Quoted 3 lines

M

#10 lore raw

PATCH 1/2 Fix warnings in arch/arm/cpu/arm920t/s3c24x0/usb_ohci.c

Hi Stefan,

Quoted 30 lines · Simon Glass

Hi Marek,

Quoted 27 lines · Marek Vasut
Quoted 27 lines · On Wednesday 16 November 2011 16:16:49 Simon Glass wrote:
Quoted 18 lines · Mike Frysinger
Quoted 16 lines · On Tuesday 15 November 2011 23:17:06 Simon Glass wrote:

arch/arm/cpu/arm920t/s3c24x0/usb_ohci.c

Quoted 11 lines
arch/arm/cpu/arm920t/s3c24x0/usb_ohci.c +6 -2
 
- ? ? __u32 datab[4];
- ? ? __u8 *data_buf = (__u8 *) datab;
+ ? ? union {
+ ? ? ? ? ? ? __u32 word[4];
+ ? ? ? ? ? ? __u16 hword[8];
+ ? ? ? ? ? ? __u8 byte[16];
+ ? ? } datab;
+ ? ? __u8 *data_buf = datab.byte;

i thought someone posted this fix to the list before. ?but maybe it was for a different controller. ?perhaps this code has been copied/pasted all over ... -mike

Quoted 3 lines

Yes I found Marek's patch to another file with the same name, and much of the same code :-( But I don't think we currently have a patch for this file. It issues warnings in about 10 ARM builds from memory.

np. ?i know much of the u-boot arm tree (like Linux) has crappy cross-SoC integration.

Is this patch another candidate for your staging activity? It fixes some build warnings for a number of ARM boards.

Regards,
Simon

Quoted 13 lines
Quoted 3 lines
Quoted 1 line

-mike

Well it kinda looks like this OHCI is copy of the drivers/usb/host/ohci-hcd.c ?

Yes it is. We really need to push back harder on this sort of thing...

Regards,
Simon

Quoted 3 lines

M

#11 lore raw

PATCH 1/2 Fix warnings in arch/arm/cpu/arm920t/s3c24x0/usb_ohci.c

Quoted 2 lines · Simon Glass

Hi Stefan,

Hi Simon,

Quoted 11 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 3 lines

Yes I found Marek's patch to another file with the same name, and much of the same code :-( But I don't think we currently have a patch for this file. It issues warnings in about 10 ARM builds from memory.

np. i know much of the u-boot arm tree (like Linux) has crappy cross-SoC integration.

Is this patch another candidate for your staging activity? It fixes some build warnings for a number of ARM boards.

No, this is related to ARM code and it is in the competence area of the ARM custodian (Albert).

Best regards,
Stefano Babic

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80  Email: office at denx.de
=====================================================================
#12 lore raw

PATCH 1/2 Fix warnings in arch/arm/cpu/arm920t/s3c24x0/usb_ohci.c

Hi Stefan,

Quoted 13 lines · Stefano Babic
Quoted 2 lines · Simon Glass

Hi Stefan,

Hi Simon,

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 3 lines

Yes I found Marek's patch to another file with the same name, and much of the same code :-( But I don't think we currently have a patch for this file. It issues warnings in about 10 ARM builds from memory.

np. ?i know much of the u-boot arm tree (like Linux) has crappy cross-SoC integration.

Quoted 7 lines
Quoted 4 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line

Is this patch another candidate for your staging activity? It fixes some build warnings for a number of ARM boards.

No, this is related to ARM code and it is in the competence area of the ARM custodian (Albert).

Thanks for the quick response.

Albert, if you have time can you please take a look?

Regards,
Simon

Quoted 11 lines

Best regards,
Stefano Babic

--
=====================================================================
DENX Software Engineering GmbH, ? ? MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80 ?Email: office at denx.de
=====================================================================

#13 lore raw

PATCH 1/2 Fix warnings in arch/arm/cpu/arm920t/s3c24x0/usb_ohci.c

In reply to Simon Glass

Dear Simon Glass,

Quoted 12 lines · In message <[email protected]> you wrote:

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

Quoted 4 lines
---
 arch/arm/cpu/arm920t/s3c24x0/usb_ohci.c |   20 ++++++++++++--------
 1 files changed, 12 insertions(+), 8 deletions(-)

Applied, thanks.

Albert, Remy - hope this is OK with you.

Best regards,

Wolfgang Denk

Signature · 4 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
If God wanted me to touch my toes, he'd have put them on my knees.