smsc95xx: fix operation on 64-bit systems
PATCH 1/1 smsc95xx: fix operation on 64-bit systems
smsc95xx_read_reg() should calculate sizeof(*data) not sizeof(data) since data is a pointer, and the value pointed at is being transferred over USB, not the value of the pointer. This fixes operation of the driver in 64-bit builds, such as the Raspberry Pi 3.
--- drivers/usb/eth/smsc95xx.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/usb/eth/smsc95xx.c +2 -2
@@ -188,10 +188,10 @@ static int smsc95xx_read_reg(struct usb_device *udev, u32 index, u32 *data) len =usb_control_msg (udev,usb_rcvctrlpipe (udev,0 ),USB_VENDOR_REQUEST_READ_REGISTER ,USB_DIR_IN |USB_TYPE_VENDOR |USB_RECIP_DEVICE , -0 , index, tmpbuf,sizeof (data), +0 , index, tmpbuf,sizeof (*data),USB_CTRL_GET_TIMEOUT ); *data = tmpbuf[0 ]; -if (len !=sizeof (data)) { +if (len !=sizeof (*data)) {debug ("smsc95xx_read_reg failed: index=%d, len=%d" , index, len);return -EIO ;
Signature · 1 line
2.7.3
PATCH 1/1 smsc95xx: fix operation on 64-bit systems
Quoted 4 lines · Stephen Warren
smsc95xx_read_reg()should calculatesizeof(*data)not sizeof(data) since data is a pointer, and the value pointed at is being transferred over USB, not the value of the pointer. This fixes operation of the driver in 64-bit builds, such as the Raspberry Pi 3.
Thanks!
Quoted 24 lines
Reported-by Eric Anholt <[email protected]>Signed-off-by Stephen Warren <[email protected]>--- drivers/usb/eth/smsc95xx.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/usb/eth/smsc95xx.c +2
-2@@ -188,10 +188,10 @@ static int smsc95xx_read_reg(struct usb_device *udev, u32 index, u32 *data) len =usb_control_msg (udev,usb_rcvctrlpipe (udev,0 ),USB_VENDOR_REQUEST_READ_REGISTER ,USB_DIR_IN |USB_TYPE_VENDOR |USB_RECIP_DEVICE , -0 , index, tmpbuf,sizeof (data), +0 , index, tmpbuf,sizeof (*data),USB_CTRL_GET_TIMEOUT ); *data = tmpbuf[0 ]; -if (len !=sizeof (data)) { +if (len !=sizeof (*data)) {debug ("smsc95xx_read_reg failed: index=%d, len=%d" , index, len);return -EIO ;
Signature · 2 lines
Best regards, Marek Vasut
PATCH 1/1 smsc95xx: fix operation on 64-bit systems
In reply to Stephen WarrenQuoted 7 lines · Stephen Warren
smsc95xx_read_reg()should calculatesizeof(*data)not sizeof(data) since data is a pointer, and the value pointed at is being transferred over USB, not the value of the pointer. This fixes operation of the driver in 64-bit builds, such as the Raspberry Pi 3.Reported-by Eric Anholt <[email protected]>Signed-off-by Stephen Warren <[email protected]>
Quoted 9 lines · Stephen Warren
smsc95xx_read_reg()should calculatesizeof(*data)not sizeof(data) since data is a pointer, and the value pointed at is being transferred over USB, not the value of the pointer. This fixes operation of the driver in 64-bit builds, such as the Raspberry Pi 3.Reported-by Eric Anholt <[email protected]>Signed-off-by Stephen Warren <[email protected]>Acked-by Marek Vasut <[email protected]>Acked-by Joe Hershberger <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160401/5d9d0d0b/attachment.sig>