USB: Fix complaints about strict aliasing in OHCI-HCD
Subsystems (2)
PATCH v2 1/2 USB: Fix complaints about strict aliasing in OHCI-HCD
--- drivers/usb/host/ohci-hcd.c | 69 +++++++++++++++++++++++------------------- 1 files changed, 38 insertions(+), 31 deletions(-)
V2: Fix comment, use union
drivers/usb/host/ohci-hcd.c +38 -31
@@ -1263,12 +1263,19 @@ static int ohci_submit_rh_msg(struct usb_device *dev, unsigned long pipe,int len =0 ;int stat =0 ;__u32 datab[4 ]; -__u8 *data_buf = (__u8 *)datab; +union { +void *ptr; +__u8 *u8; +__u16 *u16; +__u32 *u32; + } databuf;__u16 bmRType_bReq;__u16 wValue;__u16 wIndex;__u16 wLength; + databuf.u32 = (__u32 *)datab; +#ifdef DEBUG pkt_print (NULL , dev, pipe, buffer, transfer_len, cmd,"SUB(rh)" ,usb_pipein (pipe));
@@ -1298,20 +1305,20 @@ pkt_print(NULL, dev, pipe, buffer, transfer_len,*/ case RH_GET_STATUS : - *(__u16 *) data_buf =cpu_to_le16 (1 ); + databuf.u16[0 ] =cpu_to_le16 (1 );OK (2 );case RH_GET_STATUS |RH_INTERFACE : - *(__u16 *) data_buf =cpu_to_le16 (0 ); + databuf.u16[0 ] =cpu_to_le16 (0 );OK (2 );case RH_GET_STATUS |RH_ENDPOINT : - *(__u16 *) data_buf =cpu_to_le16 (0 ); + databuf.u16[0 ] =cpu_to_le16 (0 );OK (2 );case RH_GET_STATUS |RH_CLASS : - *(__u32 *) data_buf =cpu_to_le32 ( + databuf.u32[0 ] =cpu_to_le32 (RD_RH_STAT & ~(RH_HS_CRWE |RH_HS_DRWE ));OK (4 );case RH_GET_STATUS |RH_OTHER |RH_CLASS : - *(__u32 *) data_buf =cpu_to_le32 (RD_RH_PORTSTAT ); + databuf.u32[0 ] =cpu_to_le32 (RD_RH_PORTSTAT );OK (4 );case RH_CLEAR_FEATURE |RH_ENDPOINT :
@@ -1375,14 +1382,14 @@ pkt_print(NULL, dev, pipe, buffer, transfer_len, min_t(unsigned int,sizeof (root_hub_dev_des), wLength)); - data_buf = root_hub_dev_des;OK (len); + databuf.ptr = root_hub_dev_des;OK (len);case (0x02 ):/* configuration descriptor */ len = min_t(unsigned int, leni, min_t(unsigned int,sizeof (root_hub_config_des), wLength)); - data_buf = root_hub_config_des;OK (len); + databuf.ptr = root_hub_config_des;OK (len);case (0x03 ):/* string descriptors */ if (wValue ==0x0300 ) { len = min_t(unsigned int,
@@ -1390,7 +1397,7 @@ pkt_print(NULL, dev, pipe, buffer, transfer_len, min_t(unsigned int,sizeof (root_hub_str_index0), wLength)); - data_buf = root_hub_str_index0; + databuf.ptr = root_hub_str_index0;OK (len); }if (wValue ==0x0301 ) {
@@ -1399,7 +1406,7 @@ pkt_print(NULL, dev, pipe, buffer, transfer_len, min_t(unsigned int,sizeof (root_hub_str_index1), wLength)); - data_buf = root_hub_str_index1; + databuf.ptr = root_hub_str_index1;OK (len); }default :
@@ -1411,39 +1418,39 @@ pkt_print(NULL, dev, pipe, buffer, transfer_len, {__u32 temp =roothub_a (&gohci); - data_buf [0 ] =9 ;/* min length; */ - data_buf [1 ] =0x29 ; - data_buf [2 ] = temp &RH_A_NDP ; + databuf.u8[0 ] =9 ;/* min length; */ + databuf.u8[1 ] =0x29 ; + databuf.u8[2 ] = temp &RH_A_NDP ;#ifdef CONFIG_AT91C_PQFP_UHPBUG - data_buf [2 ] = (data_buf [2 ] ==2 ) ?1 :0 ; + databuf.u8[2 ] = (databuf.u8[2 ] ==2 ) ?1 :0 ;#endif - data_buf [3 ] =0 ; + databuf.u8[3 ] =0 ;if (temp &RH_A_PSM )/* per-port power switching? */ - data_buf [3 ] |=0x1 ; + databuf.u8[3 ] |=0x1 ;if (temp &RH_A_NOCP )/* no overcurrent reporting? */ - data_buf [3 ] |=0x10 ; + databuf.u8[3 ] |=0x10 ;else if (temp &RH_A_OCPM )/* per-port overcurrent reporting? */ - data_buf [3 ] |=0x8 ; + databuf.u8[3 ] |=0x8 ; -/* corresponds to data_buf[4-7] */ - datab [1 ] =0 ; - data_buf [5 ] = (temp &RH_A_POTPGT ) >>24 ; +/* corresponds to databuf.u8[4-7] */ + databuf.u8[1 ] =0 ; + databuf.u8[5 ] = (temp &RH_A_POTPGT ) >>24 ; temp =roothub_b (&gohci); - data_buf [7 ] = temp &RH_B_DR ; -if (data_buf [2 ] <7 ) { - data_buf [8 ] =0xff ; + databuf.u8[7 ] = temp &RH_B_DR ; +if (databuf.u8[2 ] <7 ) { + databuf.u8[8 ] =0xff ; }else { - data_buf [0 ] +=2 ; - data_buf [8 ] = (temp &RH_B_DR ) >>8 ; - data_buf [10 ] = data_buf [9 ] =0xff ; + databuf.u8[0 ] +=2 ; + databuf.u8[8 ] = (temp &RH_B_DR ) >>8 ; + databuf.u8[10 ] = databuf.u8[9 ] =0xff ; } len = min_t(unsigned int, leni, - min_t(unsigned int, data_buf [0], wLength)); + min_t(unsigned int, databuf.u8[0], wLength));OK (len); } -case RH_GET_CONFIGURATION : *(__u8 *) data_buf =0x01 ;OK (1 ); +case RH_GET_CONFIGURATION : databuf.u8[0 ] =0x01 ;OK (1 );case RH_SET_CONFIGURATION :WR_RH_STAT (0x10000 );OK (0 );
@@ -1459,8 +1466,8 @@ pkt_print(NULL, dev, pipe, buffer, transfer_len,#endif len =min_t (int, len, leni); -if (data != data_buf) -memcpy (data, data_buf, len); +if (data != databuf.ptr) +memcpy (data, databuf.ptr, len); dev->act_len = len; dev->status = stat;
Signature · 1 line
1.7.5.4
PATCH v2 2/2 IDE: Fix complaints about strict aliasing in cmd_ide.c
--- common/cmd_ide.c | 51 +++++++++++++++++++++++++-------------------------- 1 files changed, 25 insertions(+), 26 deletions(-)
V2: Fix comment, drop alignment
common/cmd_ide.c +25 -26
@@ -985,9 +985,8 @@ input_data(int dev, ulong *sect_buf, int words)*/ static void ide_ident (block_dev_desc_t *dev_desc) { -ulong iobuf[ATA_SECTORWORDS ];unsigned char c; -hd_driveid_t *iop = (hd_driveid_t *)iobuf; +hd_driveid_t iop;#ifdef CONFIG_ATAPI int retries =0 ;
@@ -1073,11 +1072,11 @@ static void ide_ident (block_dev_desc_t *dev_desc)return ;#endif -input_swap_data (device, iobuf,ATA_SECTORWORDS ); +input_swap_data (device, (ulong *)&iop,ATA_SECTORWORDS ); -ident_cpy ((unsigned char *)dev_desc->revision, iop->fw_rev,sizeof (dev_desc->revision)); -ident_cpy ((unsigned char *)dev_desc->vendor, iop->model,sizeof (dev_desc->vendor)); -ident_cpy ((unsigned char *)dev_desc->product, iop->serial_no,sizeof (dev_desc->product)); +ident_cpy ((unsigned char *)dev_desc->revision, iop.fw_rev,sizeof (dev_desc->revision)); +ident_cpy ((unsigned char *)dev_desc->vendor, iop.model,sizeof (dev_desc->vendor)); +ident_cpy ((unsigned char *)dev_desc->product, iop.serial_no,sizeof (dev_desc->product));#ifdef __LITTLE_ENDIAN/* * firmware revision, model, and serial number have Big Endian Byte
@@ -1092,14 +1091,14 @@ static void ide_ident (block_dev_desc_t *dev_desc)strswab (dev_desc->product);#endif /* __LITTLE_ENDIAN */ -if ((iop->config &0x0080 )==0x0080 ) +if ((iop.config &0x0080 ) ==0x0080 ) dev_desc->removable =1 ;else dev_desc->removable =0 ;#ifdef CONFIG_TUNE_PIO /* Mode 0 - 2 only, are directly determined by word 51. */ - pio_mode = iop->tPIO; + pio_mode = iop.tPIO;if (pio_mode >2 ) {printf ("WARNING: Invalid PIO (word 51 = %d).\n" , pio_mode); pio_mode =0 ;/* Force it to dead slow, and hope for the best... */
@@ -1109,18 +1108,18 @@ static void ide_ident (block_dev_desc_t *dev_desc)* shall set bit 1 of word 53 to one and support the fields contained * in words 64 through 70. */ -if (iop->field_valid &0x02 ) { +if (iop.field_valid &0x02 ) {/* Mode 3 and above are possible. Check in order from slow * to fast, so we wind up with the highest mode allowed. */ -if (iop->eide_pio_modes &0x01 ) +if (iop.eide_pio_modes &0x01 ) pio_mode =3 ; -if (iop->eide_pio_modes &0x02 ) +if (iop.eide_pio_modes &0x02 ) pio_mode =4 ; -if (ata_id_is_cfa ((u16 *)iop)) { -if ((iop->cf_advanced_caps &0x07 ) ==0x01 ) +if (ata_id_is_cfa ((u16 *)&iop)) { +if ((iop.cf_advanced_caps &0x07 ) ==0x01 ) pio_mode =5 ; -if ((iop->cf_advanced_caps &0x07 ) ==0x02 ) +if ((iop.cf_advanced_caps &0x07 ) ==0x02 ) pio_mode =6 ; } }
@@ -1133,19 +1132,19 @@ static void ide_ident (block_dev_desc_t *dev_desc)/* * Drive PIO mode autoselection */ - mode = iop->tPIO; + mode = iop.tPIO;printf ("tPIO = 0x%02x = %d\n" ,mode, mode);if (mode >2 ) {/* 2 is maximum allowed tPIO value */ mode =2 ;debug ("Override tPIO -> 2\n" ); } -if (iop->field_valid &2 ) {/* drive implements ATA2? */ +if (iop.field_valid &2 ) {/* drive implements ATA2? */ debug ("Drive implements ATA2\n" ); -if (iop->capability &8 ) {/* drive supports use_iordy? */ - cycle_time = iop->eide_pio_iordy; +if (iop.capability &8 ) {/* drive supports use_iordy? */ + cycle_time = iop.eide_pio_iordy; }else { - cycle_time = iop->eide_pio; + cycle_time = iop.eide_pio; }debug ("cycle time = %d\n" , cycle_time); mode =4 ;
@@ -1166,7 +1165,7 @@ static void ide_ident (block_dev_desc_t *dev_desc)#ifdef __BIG_ENDIAN/* swap shorts */ - dev_desc->lba = (iop->lba_capacity <<16 ) | (iop->lba_capacity >>16 ); + dev_desc->lba = (iop.lba_capacity <<16 ) | (iop.lba_capacity >>16 );#else /* ! __BIG_ENDIAN */ /* * do not swap shorts on little endian
@@ -1174,16 +1173,16 @@ static void ide_ident (block_dev_desc_t *dev_desc)* See CF+ and CompactFlash Specification Revision 2.0: * 6.2.1.6: Identfy Drive, Table 39, Word Address 57-58 for details. */ - dev_desc->lba = iop->lba_capacity; + dev_desc->lba = iop.lba_capacity;#endif /* __BIG_ENDIAN */ #ifdef CONFIG_LBA48 -if (iop->command_set_2 &0x0400 ) {/* LBA 48 support */ +if (iop.command_set_2 &0x0400 ) {/* LBA 48 support */ dev_desc->lba48 =1 ; - dev_desc->lba = (unsigned long long )iop->lba48_capacity[0 ] | - ((unsigned long long )iop->lba48_capacity[1 ] <<16 ) | - ((unsigned long long )iop->lba48_capacity[2 ] <<32 ) | - ((unsigned long long )iop->lba48_capacity[3 ] <<48 ); + dev_desc->lba = (unsigned long long )iop.lba48_capacity[0 ] | + ((unsigned long long )iop.lba48_capacity[1 ] <<16 ) | + ((unsigned long long )iop.lba48_capacity[2 ] <<32 ) | + ((unsigned long long )iop.lba48_capacity[3 ] <<48 ); }else { dev_desc->lba48 =0 ; }
Signature · 1 line
1.7.5.4
PATCH v2 2/2 IDE: Fix complaints about strict aliasing in cmd_ide.c
-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/20110820/e5018df7/attachment.pgp
Wolfgang Denk
AppliedPATCH v2 2/2 IDE: Fix complaints about strict aliasing in cmd_ide.c
In reply to Marek VasutDear Marek Vasut,
Quoted 4 lines · In message <[email protected]> you wrote:
Signed-off-by Marek Vasut <[email protected]>--- common/cmd_ide.c | 51 +++++++++++++++++++++++++-------------------------- 1 files changed, 25 insertions(+), 26 deletions(-)
Applied, thanks.
Best regards,
Wolfgang Denk
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-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de Microsoft Multimedia: You have nice graphics, sound and animations when the system crashes.
PATCH v2 1/2 USB: Fix complaints about strict aliasing in OHCI-HCD
In reply to Marek Vasutdrivers/usb/host/ohci-hcd.c static int ohci_submit_rh_msg(struct usb_device *dev, unsigned long pipe, · line 1277
Quoted 10 lines · On Saturday, August 20, 2011 15:15:12 Marek Vasut wrote:
drivers/usb/host/ohci-hcd.c +7
-1__u32 datab[4 ]; -__u8 *data_buf = (__u8 *)datab; +union { +void *ptr; +__u8 *u8; +__u16 *u16; +__u32 *u32; + } databuf; + databuf.u32 = (__u32 *)datab;
i'm not sure this is correct, but i'm not really an expert on aliasing behavior. i think the union should sit on top of the storage, and not hide the pointer casts.
-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/20110820/3b1cc807/attachment.pgp
PATCH v2 1/2 USB: Fix complaints about strict aliasing in OHCI-HCD
Quoted 11 lines · Mike Frysinger
Quoted 10 lines · On Saturday, August 20, 2011 15:15:12 Marek Vasut wrote:
drivers/usb/host/ohci-hcd.c +6
-1__u32 datab[4 ]; -__u8 *data_buf = (__u8 *)datab; +union { +void *ptr; +__u8 *u8; +__u16 *u16; +__u32 *u32; + } databuf;
Quoted 5 lines
drivers/usb/host/ohci-hcd.c static int ohci_submit_rh_msg(struct usb_device *dev, unsigned long pipe, · line 1277
Quoted 1 line
drivers/usb/host/ohci-hcd.c +1
-0+ databuf.u32 = (__u32 *)datab;i'm not sure this is correct, but i'm not really an expert on aliasing behavior. i think the union should sit on top of the storage, and not hide the pointer casts.
And endianity comes into play here too ... that's where my brain started chugging a bit too. That's why I'd like to see other's opinion on this.
Cheers
Quoted 1 line
-mike
PATCH v2 1/2 USB: Fix complaints about strict aliasing in OHCI-HCD
Quoted 12 lines · On Saturday, August 20, 2011 15:32:55 Marek Vasut wrote:
Quoted 11 lines · Mike Frysinger
Quoted 10 lines · On Saturday, August 20, 2011 15:15:12 Marek Vasut wrote:
drivers/usb/host/ohci-hcd.c +6
-1__u32 datab[4 ]; -__u8 *data_buf = (__u8 *)datab; +union { +void *ptr; +__u8 *u8; +__u16 *u16; +__u32 *u32; + } databuf;
Quoted 8 lines
Quoted 5 lines
drivers/usb/host/ohci-hcd.c static int ohci_submit_rh_msg(struct usb_device *dev, unsigned long pipe, · line 1277
Quoted 1 line
drivers/usb/host/ohci-hcd.c +1
-0+ databuf.u32 = (__u32 *)datab;i'm not sure this is correct, but i'm not really an expert on aliasing behavior. i think the union should sit on top of the storage, and not hide the pointer casts.
And endianity comes into play here too ... that's where my brain started chugging a bit too. That's why I'd like to see other's opinion on this.
endianness isn't an issue between the union-of-pointers and union-of-storage. in both cases, you start at the same base address.
-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/20110820/d2975c7b/attachment.pgp
PATCH v2 1/2 USB: Fix complaints about strict aliasing in OHCI-HCD
In reply to Marek VasutDear Marek Vasut,
Quoted 6 lines · In message <[email protected]> you wrote:
Signed-off-by Marek Vasut <[email protected]>--- drivers/usb/host/ohci-hcd.c | 69 +++++++++++++++++++++++------------------- 1 files changed, 38 insertions(+), 31 deletions(-)V2: Fix comment, use union
Checkpatch says:
total: 2 errors, 1 warnings, 145 lines checked
Please clean up and resubmit. Thanks.
Best regards,
Wolfgang Denk
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-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de Power is danger. -- The Centurion, "Balance of Terror", stardate 1709.2
PATCH v3 1/2 USB: Fix complaints about strict aliasing in OHCI-HCD
In reply to Marek Vasut--- drivers/usb/host/ohci-hcd.c | 75 ++++++++++++++++++++++++------------------ 1 files changed, 43 insertions(+), 32 deletions(-)
V2: Fix comment, use union
V3: Fix checkpatch warnings (btw. these were from the original code, Remy, would
you mind cleaning up ohci-hcd.c please ? )
drivers/usb/host/ohci-hcd.c +43 -32
@@ -1263,12 +1263,19 @@ static int ohci_submit_rh_msg(struct usb_device *dev, unsigned long pipe,int len =0 ;int stat =0 ;__u32 datab[4 ]; -__u8 *data_buf = (__u8 *)datab; +union { +void *ptr; +__u8 *u8; +__u16 *u16; +__u32 *u32; + } databuf;__u16 bmRType_bReq;__u16 wValue;__u16 wIndex;__u16 wLength; + databuf.u32 = (__u32 *)datab; +#ifdef DEBUG pkt_print (NULL , dev, pipe, buffer, transfer_len, cmd,"SUB(rh)" ,usb_pipein (pipe));
@@ -1298,20 +1305,20 @@ pkt_print(NULL, dev, pipe, buffer, transfer_len,*/ case RH_GET_STATUS : - *(__u16 *) data_buf =cpu_to_le16 (1 ); + databuf.u16[0 ] =cpu_to_le16 (1 );OK (2 );case RH_GET_STATUS |RH_INTERFACE : - *(__u16 *) data_buf =cpu_to_le16 (0 ); + databuf.u16[0 ] =cpu_to_le16 (0 );OK (2 );case RH_GET_STATUS |RH_ENDPOINT : - *(__u16 *) data_buf =cpu_to_le16 (0 ); + databuf.u16[0 ] =cpu_to_le16 (0 );OK (2 );case RH_GET_STATUS |RH_CLASS : - *(__u32 *) data_buf =cpu_to_le32 ( + databuf.u32[0 ] =cpu_to_le32 (RD_RH_STAT & ~(RH_HS_CRWE |RH_HS_DRWE ));OK (4 );case RH_GET_STATUS |RH_OTHER |RH_CLASS : - *(__u32 *) data_buf =cpu_to_le32 (RD_RH_PORTSTAT ); + databuf.u32[0 ] =cpu_to_le32 (RD_RH_PORTSTAT );OK (4 );case RH_CLEAR_FEATURE |RH_ENDPOINT :
@@ -1375,14 +1382,14 @@ pkt_print(NULL, dev, pipe, buffer, transfer_len, min_t(unsigned int,sizeof (root_hub_dev_des), wLength)); - data_buf = root_hub_dev_des;OK (len); + databuf.ptr = root_hub_dev_des;OK (len);case (0x02 ):/* configuration descriptor */ len = min_t(unsigned int, leni, min_t(unsigned int,sizeof (root_hub_config_des), wLength)); - data_buf = root_hub_config_des;OK (len); + databuf.ptr = root_hub_config_des;OK (len);case (0x03 ):/* string descriptors */ if (wValue ==0x0300 ) { len = min_t(unsigned int,
@@ -1390,7 +1397,7 @@ pkt_print(NULL, dev, pipe, buffer, transfer_len, min_t(unsigned int,sizeof (root_hub_str_index0), wLength)); - data_buf = root_hub_str_index0; + databuf.ptr = root_hub_str_index0;OK (len); }if (wValue ==0x0301 ) {
@@ -1399,7 +1406,7 @@ pkt_print(NULL, dev, pipe, buffer, transfer_len, min_t(unsigned int,sizeof (root_hub_str_index1), wLength)); - data_buf = root_hub_str_index1; + databuf.ptr = root_hub_str_index1;OK (len); }default :
@@ -1411,41 +1418,45 @@ pkt_print(NULL, dev, pipe, buffer, transfer_len, {__u32 temp =roothub_a (&gohci); - data_buf [0 ] =9 ;/* min length; */ - data_buf [1 ] =0x29 ; - data_buf [2 ] = temp &RH_A_NDP ; + databuf.u8[0 ] =9 ;/* min length; */ + databuf.u8[1 ] =0x29 ; + databuf.u8[2 ] = temp &RH_A_NDP ;#ifdef CONFIG_AT91C_PQFP_UHPBUG - data_buf [2 ] = (data_buf [2 ] ==2 ) ?1 :0 ; + databuf.u8[2 ] = (databuf.u8[2 ] ==2 ) ?1 :0 ;#endif - data_buf [3 ] =0 ; + databuf.u8[3 ] =0 ;if (temp &RH_A_PSM )/* per-port power switching? */ - data_buf [3 ] |=0x1 ; + databuf.u8[3 ] |=0x1 ;if (temp &RH_A_NOCP )/* no overcurrent reporting? */ - data_buf [3 ] |=0x10 ; + databuf.u8[3 ] |=0x10 ;else if (temp &RH_A_OCPM )/* per-port overcurrent reporting? */ - data_buf [3 ] |=0x8 ; + databuf.u8[3 ] |=0x8 ; -/* corresponds to data_buf[4-7] */ - datab [1 ] =0 ; - data_buf [5 ] = (temp &RH_A_POTPGT ) >>24 ; +/* corresponds to databuf.u8[4-7] */ + databuf.u8[1 ] =0 ; + databuf.u8[5 ] = (temp &RH_A_POTPGT ) >>24 ; temp =roothub_b (&gohci); - data_buf [7 ] = temp &RH_B_DR ; -if (data_buf [2 ] <7 ) { - data_buf [8 ] =0xff ; + databuf.u8[7 ] = temp &RH_B_DR ; +if (databuf.u8[2 ] <7 ) { + databuf.u8[8 ] =0xff ; }else { - data_buf [0 ] +=2 ; - data_buf [8 ] = (temp &RH_B_DR ) >>8 ; - data_buf [10 ] = data_buf [9 ] =0xff ; + databuf.u8[0 ] +=2 ; + databuf.u8[8 ] = (temp &RH_B_DR ) >>8 ; + databuf.u8[10 ] = databuf.u8[9 ] =0xff ; } len = min_t(unsigned int, leni, - min_t(unsigned int, data_buf [0], wLength)); + min_t(unsigned int, databuf.u8[0], wLength));OK (len); } -case RH_GET_CONFIGURATION : *(__u8 *) data_buf =0x01 ;OK (1 ); +case RH_GET_CONFIGURATION : + databuf.u8[0 ] =0x01 ; +OK (1 ); -case RH_SET_CONFIGURATION :WR_RH_STAT (0x10000 );OK (0 ); +case RH_SET_CONFIGURATION : +WR_RH_STAT (0x10000 ); +OK (0 );default :dbg ("unsupported root hub command" );
@@ -1459,8 +1470,8 @@ pkt_print(NULL, dev, pipe, buffer, transfer_len,#endif len =min_t (int, len, leni); -if (data != data_buf) -memcpy (data, data_buf, len); +if (data != databuf.ptr) +memcpy (data, databuf.ptr, len); dev->act_len = len; dev->status = stat;
Signature · 1 line
1.7.6.3
PATCH v3 1/2 USB: Fix complaints about strict aliasing in OHCI-HCD
Hi,
2011/10/7 Marek Vasut <[email protected]>:
Quoted 4 lines
Signed-off-by Marek Vasut <[email protected]>---
?drivers/usb/host/ohci-hcd.c | ? 75 ++++++++++++++++++++++++------------------ ?1 files changed, 43 insertions(+), 32 deletions(-)
Applied to u-boot-usb. Thanks.
Quoted 3 lines
V2: Fix comment, use union
V3: Fix checkpatch warnings (btw. these were from the original code, Remy, would ? ?you mind cleaning upohci-hcd.cplease ? )
I will have a look at it.
Kind regards,
Remy