[U-Boot] [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
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;

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
Signed-off-by: Simon Glass sjg@chromium.org --- fs/yaffs2/yaffs_tagscompat.c | 15 +++++++-------- 1 files changed, 7 insertions(+), 8 deletions(-)
diff --git a/fs/yaffs2/yaffs_tagscompat.c b/fs/yaffs2/yaffs_tagscompat.c index 70a8a8c..e872323 100644 --- a/fs/yaffs2/yaffs_tagscompat.c +++ b/fs/yaffs2/yaffs_tagscompat.c @@ -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; } }

Dear Simon Glass,
In message 1321417027-5639-2-git-send-email-sjg@chromium.org 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
Signed-off-by: Simon Glass sjg@chromium.org
fs/yaffs2/yaffs_tagscompat.c | 15 +++++++-------- 1 files changed, 7 insertions(+), 8 deletions(-)
Applied, thanks.
Best regards,
Wolfgang Denk

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

Hi Mike,
On Wed, Nov 16, 2011 at 1:38 PM, Mike Frysinger vapier@gentoo.org wrote:
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

On Tuesday 15 November 2011 23:17:06 Simon Glass wrote:
--- a/arch/arm/cpu/arm920t/s3c24x0/usb_ohci.c +++ b/arch/arm/cpu/arm920t/s3c24x0/usb_ohci.c
- __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

Hi Mike,
On Wed, Nov 16, 2011 at 8:03 AM, Mike Frysinger vapier@gentoo.org wrote:
On Tuesday 15 November 2011 23:17:06 Simon Glass wrote:
--- a/arch/arm/cpu/arm920t/s3c24x0/usb_ohci.c +++ b/arch/arm/cpu/arm920t/s3c24x0/usb_ohci.c
- __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

On Wednesday 16 November 2011 16:16:49 Simon Glass wrote:
On Wed, Nov 16, 2011 at 8:03 AM, Mike Frysinger wrote:
On Tuesday 15 November 2011 23:17:06 Simon Glass wrote:
--- a/arch/arm/cpu/arm920t/s3c24x0/usb_ohci.c +++ b/arch/arm/cpu/arm920t/s3c24x0/usb_ohci.c
__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.
np. i know much of the u-boot arm tree (like Linux) has crappy cross-SoC integration.
Acked-by: Mike Frysinger vapier@gentoo.org -mike

On Wednesday 16 November 2011 16:16:49 Simon Glass wrote:
On Wed, Nov 16, 2011 at 8:03 AM, Mike Frysinger wrote:
On Tuesday 15 November 2011 23:17:06 Simon Glass wrote:
--- a/arch/arm/cpu/arm920t/s3c24x0/usb_ohci.c +++ b/arch/arm/cpu/arm920t/s3c24x0/usb_ohci.c
__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.
np. i know much of the u-boot arm tree (like Linux) has crappy cross-SoC integration.
Acked-by: Mike Frysinger vapier@gentoo.org -mike
Well it kinda looks like this OHCI is copy of the drivers/usb/host/ohci-hcd.c ?
M

Hi Marek,
On Thu, Nov 17, 2011 at 6:35 PM, Marek Vasut marek.vasut@gmail.com wrote:
On Wednesday 16 November 2011 16:16:49 Simon Glass wrote:
On Wed, Nov 16, 2011 at 8:03 AM, Mike Frysinger wrote:
On Tuesday 15 November 2011 23:17:06 Simon Glass wrote:
--- a/arch/arm/cpu/arm920t/s3c24x0/usb_ohci.c +++ b/arch/arm/cpu/arm920t/s3c24x0/usb_ohci.c
- __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.
np. i know much of the u-boot arm tree (like Linux) has crappy cross-SoC integration.
Acked-by: Mike Frysinger vapier@gentoo.org -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
M

Hi Stefan,
On Fri, Nov 18, 2011 at 2:47 PM, Simon Glass sjg@chromium.org wrote:
Hi Marek,
On Thu, Nov 17, 2011 at 6:35 PM, Marek Vasut marek.vasut@gmail.com wrote:
On Wednesday 16 November 2011 16:16:49 Simon Glass wrote:
On Wed, Nov 16, 2011 at 8:03 AM, Mike Frysinger wrote:
On Tuesday 15 November 2011 23:17:06 Simon Glass wrote:
--- a/arch/arm/cpu/arm920t/s3c24x0/usb_ohci.c +++ b/arch/arm/cpu/arm920t/s3c24x0/usb_ohci.c
- __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.
np. i know much of the u-boot arm tree (like Linux) has crappy cross-SoC integration.
Acked-by: Mike Frysinger vapier@gentoo.org
Is this patch another candidate for your staging activity? It fixes some build warnings for a number of ARM boards.
Regards, Simon
-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
M

On 02/12/2011 17:33, Simon Glass wrote:
Hi Stefan,
Hi Simon,
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.
Acked-by: Mike Frysinger vapier@gentoo.org
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

Hi Stefan,
On Fri, Dec 2, 2011 at 8:53 AM, Stefano Babic sbabic@denx.de wrote:
On 02/12/2011 17:33, Simon Glass wrote:
Hi Stefan,
Hi Simon,
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.
Acked-by: Mike Frysinger vapier@gentoo.org
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
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@denx.de =====================================================================

Dear Simon Glass,
In message 1321417027-5639-1-git-send-email-sjg@chromium.org 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
Signed-off-by: Simon Glass sjg@chromium.org
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
participants (5)
-
Marek Vasut
-
Mike Frysinger
-
Simon Glass
-
Stefano Babic
-
Wolfgang Denk