diff options
author | hayeswang <hayeswang@realtek.com> | 2013-07-12 04:26:16 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2013-07-12 19:13:34 -0400 |
commit | e76385240ee5c812267319c9084e5a0d62bfbf90 (patch) | |
tree | 30aa19dc4336799d3cb60a5ac6adcd4f3b34675b | |
parent | 3ff25e3c4531aff5b1a96e2ea6e1a2d355263019 (diff) |
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: Hayes Wang <hayeswang@realtek.com>
Spotted-by: kbuild test robot <fengguang.wu@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/net/usb/r815x.c | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/drivers/net/usb/r815x.c b/drivers/net/usb/r815x.c index 65167377ff09..852392269718 100644 --- a/drivers/net/usb/r815x.c +++ b/drivers/net/usb/r815x.c | |||
@@ -26,16 +26,18 @@ static int pla_read_word(struct usb_device *udev, u16 index) | |||
26 | { | 26 | { |
27 | int data, ret; | 27 | int data, ret; |
28 | u8 shift = index & 2; | 28 | u8 shift = index & 2; |
29 | __le32 ocp_data; | ||
29 | 30 | ||
30 | index &= ~3; | 31 | index &= ~3; |
31 | 32 | ||
32 | ret = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), | 33 | ret = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), |
33 | RTL815x_REQ_GET_REGS, RTL815x_REQT_READ, | 34 | RTL815x_REQ_GET_REGS, RTL815x_REQT_READ, |
34 | index, MCU_TYPE_PLA, &data, sizeof(data), 500); | 35 | index, MCU_TYPE_PLA, &ocp_data, sizeof(ocp_data), |
36 | 500); | ||
35 | if (ret < 0) | 37 | if (ret < 0) |
36 | return ret; | 38 | return ret; |
37 | 39 | ||
38 | data = __le32_to_cpu(data); | 40 | data = __le32_to_cpu(ocp_data); |
39 | data >>= (shift * 8); | 41 | data >>= (shift * 8); |
40 | data &= 0xffff; | 42 | data &= 0xffff; |
41 | 43 | ||
@@ -44,7 +46,8 @@ static int pla_read_word(struct usb_device *udev, u16 index) | |||
44 | 46 | ||
45 | static int pla_write_word(struct usb_device *udev, u16 index, u32 data) | 47 | static int pla_write_word(struct usb_device *udev, u16 index, u32 data) |
46 | { | 48 | { |
47 | u32 tmp, mask = 0xffff; | 49 | __le32 ocp_data; |
50 | u32 mask = 0xffff; | ||
48 | u16 byen = BYTE_EN_WORD; | 51 | u16 byen = BYTE_EN_WORD; |
49 | u8 shift = index & 2; | 52 | u8 shift = index & 2; |
50 | int ret; | 53 | int ret; |
@@ -60,18 +63,18 @@ static int pla_write_word(struct usb_device *udev, u16 index, u32 data) | |||
60 | 63 | ||
61 | ret = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), | 64 | ret = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), |
62 | RTL815x_REQ_GET_REGS, RTL815x_REQT_READ, | 65 | RTL815x_REQ_GET_REGS, RTL815x_REQT_READ, |
63 | index, MCU_TYPE_PLA, &tmp, sizeof(tmp), 500); | 66 | index, MCU_TYPE_PLA, &ocp_data, sizeof(ocp_data), |
67 | 500); | ||
64 | if (ret < 0) | 68 | if (ret < 0) |
65 | return ret; | 69 | return ret; |
66 | 70 | ||
67 | tmp = __le32_to_cpu(tmp) & ~mask; | 71 | data |= __le32_to_cpu(ocp_data) & ~mask; |
68 | tmp |= data; | 72 | ocp_data = __cpu_to_le32(data); |
69 | tmp = __cpu_to_le32(tmp); | ||
70 | 73 | ||
71 | ret = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), | 74 | ret = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), |
72 | RTL815x_REQ_SET_REGS, RTL815x_REQT_WRITE, | 75 | RTL815x_REQ_SET_REGS, RTL815x_REQT_WRITE, |
73 | index, MCU_TYPE_PLA | byen, &tmp, | 76 | index, MCU_TYPE_PLA | byen, &ocp_data, |
74 | sizeof(tmp), 500); | 77 | sizeof(ocp_data), 500); |
75 | 78 | ||
76 | return ret; | 79 | return ret; |
77 | } | 80 | } |