Commit e7638524 authored by hayeswang's avatar hayeswang Committed by David S. Miller

usb/net/r815x: fix cast to restricted __le32

>> drivers/net/usb/r815x.c:38:16: sparse: cast to restricted __le32
>> drivers/net/usb/r815x.c:67:15: sparse: cast to restricted __le32
>> drivers/net/usb/r815x.c:69:13: sparse: incorrect type in assignment (different base types)
   drivers/net/usb/r815x.c:69:13:    expected unsigned int [unsigned] [addressable] [assigned] [usertype] tmp
   drivers/net/usb/r815x.c:69:13:    got restricted __le32 [usertype] <noident>
Signed-off-by: default avatarHayes Wang <hayeswang@realtek.com>
Spotted-by: default avatarkbuild test robot <fengguang.wu@intel.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 3ff25e3c
...@@ -26,16 +26,18 @@ static int pla_read_word(struct usb_device *udev, u16 index) ...@@ -26,16 +26,18 @@ static int pla_read_word(struct usb_device *udev, u16 index)
{ {
int data, ret; int data, ret;
u8 shift = index & 2; u8 shift = index & 2;
__le32 ocp_data;
index &= ~3; index &= ~3;
ret = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), ret = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0),
RTL815x_REQ_GET_REGS, RTL815x_REQT_READ, RTL815x_REQ_GET_REGS, RTL815x_REQT_READ,
index, MCU_TYPE_PLA, &data, sizeof(data), 500); index, MCU_TYPE_PLA, &ocp_data, sizeof(ocp_data),
500);
if (ret < 0) if (ret < 0)
return ret; return ret;
data = __le32_to_cpu(data); data = __le32_to_cpu(ocp_data);
data >>= (shift * 8); data >>= (shift * 8);
data &= 0xffff; data &= 0xffff;
...@@ -44,7 +46,8 @@ static int pla_read_word(struct usb_device *udev, u16 index) ...@@ -44,7 +46,8 @@ static int pla_read_word(struct usb_device *udev, u16 index)
static int pla_write_word(struct usb_device *udev, u16 index, u32 data) static int pla_write_word(struct usb_device *udev, u16 index, u32 data)
{ {
u32 tmp, mask = 0xffff; __le32 ocp_data;
u32 mask = 0xffff;
u16 byen = BYTE_EN_WORD; u16 byen = BYTE_EN_WORD;
u8 shift = index & 2; u8 shift = index & 2;
int ret; int ret;
...@@ -60,18 +63,18 @@ static int pla_write_word(struct usb_device *udev, u16 index, u32 data) ...@@ -60,18 +63,18 @@ static int pla_write_word(struct usb_device *udev, u16 index, u32 data)
ret = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), ret = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0),
RTL815x_REQ_GET_REGS, RTL815x_REQT_READ, RTL815x_REQ_GET_REGS, RTL815x_REQT_READ,
index, MCU_TYPE_PLA, &tmp, sizeof(tmp), 500); index, MCU_TYPE_PLA, &ocp_data, sizeof(ocp_data),
500);
if (ret < 0) if (ret < 0)
return ret; return ret;
tmp = __le32_to_cpu(tmp) & ~mask; data |= __le32_to_cpu(ocp_data) & ~mask;
tmp |= data; ocp_data = __cpu_to_le32(data);
tmp = __cpu_to_le32(tmp);
ret = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), ret = usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
RTL815x_REQ_SET_REGS, RTL815x_REQT_WRITE, RTL815x_REQ_SET_REGS, RTL815x_REQT_WRITE,
index, MCU_TYPE_PLA | byen, &tmp, index, MCU_TYPE_PLA | byen, &ocp_data,
sizeof(tmp), 500); sizeof(ocp_data), 500);
return ret; return ret;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment