]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
HID: lenovo: Fix to ensure the data as __le32 instead of u32
authorVishnu Sankar <vishnuocv@gmail.com>
Tue, 14 Jan 2025 00:41:58 +0000 (09:41 +0900)
committerJiri Kosina <jkosina@suse.com>
Tue, 4 Mar 2025 20:14:29 +0000 (21:14 +0100)
Ensure that data is treated as __le32 instead of u32 before
applying le32_to_cpu.
This patch fixes the sparse warning "sparse: cast to restricted __le32".

Signed-off-by: Vishnu Sankar <vishnuocv@gmail.com>
Signed-off-by: Vishnu Sankar <vsankar@lenovo.com>
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202501101635.qJrwAOwf-lkp@intel.com/
Signed-off-by: Jiri Kosina <jkosina@suse.com>
drivers/hid/hid-lenovo.c

index a7d9ca02779eaf91fe1ed1d24bf399d9fb34a6b5..04508c36bdc8230d6050827fee211278e4d89f27 100644 (file)
@@ -778,7 +778,7 @@ static int lenovo_raw_event(struct hid_device *hdev,
        if (unlikely((hdev->product == USB_DEVICE_ID_LENOVO_X12_TAB
                        || hdev->product == USB_DEVICE_ID_LENOVO_X12_TAB2)
                        && size >= 3 && report->id == 0x03))
-               return lenovo_raw_event_TP_X12_tab(hdev, le32_to_cpu(*(u32 *)data));
+               return lenovo_raw_event_TP_X12_tab(hdev, le32_to_cpu(*(__le32 *)data));
 
        return 0;
 }