HID: hid-sensor-hub: Fix sparse warning
Subsystems (2)
Srinivas Pandruvada
maintainerPATCH 1/1 HID: hid-sensor-hub: Fix sparse warning
Address issue reported by kbuild test robot <[email protected]>
sparse warnings: (new ones prefixed by >>)
Quoted 1 line
Quoted 1 line
drivers/hid/hid-sensor-hub.c:223:39: sparse: incorrect type in argument 3 (different base types)
drivers/hid/hid-sensor-hub.c:223:39: expected signed int [signed] [usertype] [explicitly-signed] <noident>
drivers/hid/hid-sensor-hub.c:223:39: got restricted __le32 [usertype] <noident>
Quoted 1 line
Quoted 1 line
drivers/hid/hid-sensor-hub.c:231:31: sparse: incorrect type in argument 3 (different base types)
drivers/hid/hid-sensor-hub.c:231:31: expected signed int [signed] [usertype] [explicitly-signed] <noident>
drivers/hid/hid-sensor-hub.c:231:31: got restricted __le32 [usertype] <noident>
vim +223 drivers/hid/hid-sensor-hub.c
217 }
218
219 remaining_bytes = do_div(buffer_size, sizeof(__s32));
220 if (buffer_size) {
221 for (i = 0; i < buffer_size; ++i) {
222 hid_set_field(report->field[field_index], i,
Quoted 1 line
223
cpu_to_le32(*buf32));
224 ++buf32;
225 }
226 }
227 if (remaining_bytes) {
228 value = 0; 229 memcpy(&value, (u8 *)buf32, remaining_bytes); 230 hid_set_field(report->field[field_index], i,
Quoted 1 line
231
cpu_to_le32(value));
232 } 233 hid_hw_request(hsdev->hdev, report, HID_REQ_SET_REPORT); 234 hid_hw_wait(hsdev->hdev);
Since I can't change the type of hid_set_field argument 3, using __force __s32 to remove this warning.
---
--- drivers/hid/hid-sensor-hub.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/hid/hid-sensor-hub.c +2 -2
@@ -222,7 +222,7 @@ int sensor_hub_set_feature(struct hid_sensor_hub_device *hsdev, u32 report_id,if (buffer_size) {for (i =0 ; i < buffer_size; ++i) {hid_set_field (report->field[field_index], i, -cpu_to_le32 (*buf32)); + (__force __s32 )cpu_to_le32 (*buf32)); ++buf32; } }
@@ -230,7 +230,7 @@ int sensor_hub_set_feature(struct hid_sensor_hub_device *hsdev, u32 report_id, value =0 ;memcpy (&value, (u8 *)buf32, remaining_bytes);hid_set_field (report->field[field_index], i, -cpu_to_le32 (value)); + (__force __s32 )cpu_to_le32 (value)); }hid_hw_request (hsdev->hdev, report,HID_REQ_SET_REPORT );hid_hw_wait (hsdev->hdev);
Signature · 1 line
1.9.1
Jiri Kosina
AppliedQuoted 27 lines · Srinivas Pandruvada
Address issue reported by kbuild test robot <[email protected]>
sparse warnings: (new ones prefixed by >>)
Quoted 1 line
Quoted 1 line
drivers/hid/hid-sensor-hub.c:223:39: sparse: incorrect type in argument 3 (different base types)
drivers/hid/hid-sensor-hub.c:223:39: expected signed int [signed] [usertype] [explicitly-signed] <noident>
drivers/hid/hid-sensor-hub.c:223:39: got restricted__le32[usertype] <noident>Quoted 1 line
Quoted 1 line
drivers/hid/hid-sensor-hub.c:231:31: sparse: incorrect type in argument 3 (different base types)
drivers/hid/hid-sensor-hub.c:231:31: expected signed int [signed] [usertype] [explicitly-signed] <noident>
drivers/hid/hid-sensor-hub.c:231:31: got restricted__le32[usertype] <noident>vim +223
drivers/hid/hid-sensor-hub.c217 } 218 219 remaining_bytes = do_div(buffer_size, sizeof(__s32)); 220 if (buffer_size) { 221 for (i = 0; i < buffer_size; ++i) { 222 hid_set_field(report->field[field_index], i,Quoted 1 line
223
cpu_to_le32(*buf32));224 ++buf32; 225 } 226 } 227 if (remaining_bytes) { 228 value = 0; 229 memcpy(&value, (u8 *)buf32, remaining_bytes); 230 hid_set_field(report->field[field_index], i,
Quoted 7 lines
Quoted 1 line
231
cpu_to_le32(value));232 } 233 hid_hw_request(hsdev->hdev, report, HID_REQ_SET_REPORT); 234 hid_hw_wait(hsdev->hdev);Since I can't change the type of
hid_set_fieldargument 3, using__force__s32to remove this warning.
Queued in for-4.1/sensor-hub
Quoted 1 line
---
This '---' is wrong here, it would make git ignore your signoff. I have fixed that up.
Quoted 2 lines
Signed-off-by Srinivas Pandruvada <[email protected]>
Signature · 2 lines
Jiri Kosina SUSE Labs