Skip to contentSkip to conversation

HID: uclogic: Fix warning in uclogic_rdesc_template_apply

PATCH RESEND Applied José Expósito 2 participants 2 messages Aug 15, 2022 – Aug 25, 2022 HID

lore
Share & tools
lore
#0 lore raw

PATCH RESEND 1/1 HID: uclogic: Fix warning in uclogic_rdesc_template_apply

Building with Sparse enabled prints this warning:

warning: incorrect type in assignment (different base types)
expected signed int x
got restricted __le32 [usertype]

Cast the return value of cpu_to_le32() to fix the warning.

Fixes 08177f4 ("HID: uclogic: merge hid-huion driver in hid-uclogic")

---

Kindly resending this patch so it doesn't get lost after the merge window.

---
 drivers/hid/hid-uclogic-rdesc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hid/hid-uclogic-rdesc.c +1 -1
index 3d68e8b0784d..81ca22398ed5 100644
@@ -1113,7 +1113,7 @@ __u8 *uclogic_rdesc_template_apply(const __u8 *template_ptr,
 		    memcmp(p, pen_head, sizeof(pen_head)) == 0 &&
 		    p[sizeof(pen_head)] < param_num) {
 			v = param_list[p[sizeof(pen_head)]];
-			put_unaligned(cpu_to_le32(v), (s32 *)p);
+			put_unaligned((__force u32)cpu_to_le32(v), (s32 *)p);
 			p += sizeof(pen_head) + 1;
 		} else if (memcmp(p, btn_head, sizeof(btn_head)) == 0 &&
 			   p[sizeof(btn_head)] < param_num) {
Signature · 1 line
2.25.1
maintainer Applied
#1 lore raw
Quoted 24 lines · José Expósito

Building with Sparse enabled prints this warning:

warning: incorrect type in assignment (different base types)
expected signed int x
got restricted __le32 [usertype]

Cast the return value of cpu_to_le32() to fix the warning.

Fixes 08177f4 ("HID: uclogic: merge hid-huion driver in hid-uclogic")

---

Kindly resending this patch so it doesn't get lost after the merge window.

---
 drivers/hid/hid-uclogic-rdesc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hid/hid-uclogic-rdesc.c +0 -0
index 3d68e8b0784d..81ca22398ed5 100644

drivers/hid/hid-uclogic-rdesc.c __u8 *uclogic_rdesc_template_apply(const __u8 *template_ptr, · line 1119

Quoted 8 lines
drivers/hid/hid-uclogic-rdesc.c +1 -1
@@ -1113,7 +1113,7 @@ __u8 *uclogic_rdesc_template_apply(const __u8 *template_ptr,
 		    memcmp(p, pen_head, sizeof(pen_head)) == 0 &&
 		    p[sizeof(pen_head)] < param_num) {
 			v = param_list[p[sizeof(pen_head)]];
-			put_unaligned(cpu_to_le32(v), (s32 *)p);
+			put_unaligned((__force u32)cpu_to_le32(v), (s32 *)p);
 			p += sizeof(pen_head) + 1;
 		} else if (memcmp(p, btn_head, sizeof(btn_head)) == 0 &&
 			   p[sizeof(btn_head)] < param_num) {

Applied, thank you José.

Signature · 2 lines
Jiri Kosina
SUSE Labs