[hid:for-6.14/lenovo 1/1] drivers/hid/hid-lenovo.c:727:73: sparse: sparse: incompatible types in conditional expression (different base types):
From: kernel test robot <hidden>
Date: 2025-01-10 08:31:25
Also in:
oe-kbuild-all
tree: https://git.kernel.org/pub/scm/linux/kernel/git/hid/hid.git for-6.14/lenovo head: 84c9d2a968c8276f1ceddaa1526c803263eae2b4 commit: 84c9d2a968c8276f1ceddaa1526c803263eae2b4 [1/1] HID: lenovo: Support for ThinkPad-X12-TAB-1/2 Kbd Fn keys config: i386-randconfig-062-20250110 (https://download.01.org/0day-ci/archive/20250110/202501101635.qJrwAOwf-lkp@intel.com/config) compiler: clang version 19.1.3 (https://github.com/llvm/llvm-project ab51eccf88f5321e7c60591c5546b254b6afab99) reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250110/202501101635.qJrwAOwf-lkp@intel.com/reproduce) If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags | Reported-by: kernel test robot [off-list ref] | Closes: https://lore.kernel.org/oe-kbuild-all/202501101635.qJrwAOwf-lkp@intel.com/ (local) sparse warnings: (new ones prefixed by >>)
quoted
drivers/hid/hid-lenovo.c:727:73: sparse: sparse: incompatible types in conditional expression (different base types):
drivers/hid/hid-lenovo.c:727:73: sparse: void drivers/hid/hid-lenovo.c:727:73: sparse: int
quoted
drivers/hid/hid-lenovo.c:776:58: sparse: sparse: cast to restricted __le32
drivers/hid/hid-lenovo.c: note: in included file (through include/linux/mmzone.h, include/linux/gfp.h, include/linux/umh.h, include/linux/kmod.h, ...):
include/linux/page-flags.h:237:46: sparse: sparse: self-comparison always evaluates to false
include/linux/page-flags.h:237:46: sparse: sparse: self-comparison always evaluates to false
vim +727 drivers/hid/hid-lenovo.c
702
703 /* Function to handle Lenovo Thinkpad TAB X12's HID raw inputs for fn keys*/
704 static int lenovo_raw_event_TP_X12_tab(struct hid_device *hdev, u32 raw_data)
705 {
706 struct hid_input *hidinput;
707 struct input_dev *input = NULL;
708
709 /* Iterate through all associated input devices */
710 list_for_each_entry(hidinput, &hdev->inputs, list) {
711 input = hidinput->input;
712 if (!input)
713 continue;
714
715 switch (raw_data) {
716 /* fn-F20 being used here for MIC mute*/
717 case TP_X12_RAW_HOTKEY_FN_F4:
718 report_key_event(input, LENOVO_KEY_MICMUTE);
719 return 1;
720 /* Power-mode or Airplane mode will be called based on the device*/
721 case TP_X12_RAW_HOTKEY_FN_F8:
722 /*
723 * TP X12 TAB uses Fn-F8 calls Airplanemode
724 * Whereas TP X12 TAB2 uses Fn-F8 for toggling
725 * Power modes
726 */
> 727 (hdev->product == USB_DEVICE_ID_LENOVO_X12_TAB) ?
728 report_key_event(input, KEY_RFKILL) :
729 platform_profile_cycle();
730 return 1;
731 case TP_X12_RAW_HOTKEY_FN_F10:
732 /* TAB1 has PICKUP Phone and TAB2 use Snipping tool*/
733 (hdev->product == USB_DEVICE_ID_LENOVO_X12_TAB) ?
734 report_key_event(input, KEY_PICKUP_PHONE) :
735 report_key_event(input, KEY_SELECTIVE_SCREENSHOT);
736 return 1;
737 case TP_X12_RAW_HOTKEY_FN_F12:
738 /* BookMarks/STAR key*/
739 report_key_event(input, KEY_BOOKMARKS);
740 return 1;
741 case TP_X12_RAW_HOTKEY_FN_SPACE:
742 /* Keyboard LED backlight toggle*/
743 report_key_event(input, KEY_KBDILLUMTOGGLE);
744 return 1;
745 default:
746 break;
747 }
748 }
749 return 0;
750 }
751
752 static int lenovo_raw_event(struct hid_device *hdev,
753 struct hid_report *report, u8 *data, int size)
754 {
755 /*
756 * Compact USB keyboard's Fn-F12 report holds down many other keys, and
757 * its own key is outside the usage page range. Remove extra
758 * keypresses and remap to inside usage page.
759 */
760 if (unlikely(hdev->product == USB_DEVICE_ID_LENOVO_CUSBKBD
761 && size == 3
762 && data[0] == 0x15
763 && data[1] == 0x94
764 && data[2] == 0x01)) {
765 data[1] = 0x00;
766 data[2] = 0x01;
767 }
768
769 /*
770 * Lenovo TP X12 Tab KBD's Fn+XX is HID raw data defined. Report ID is 0x03
771 * e.g.: Raw data received for MIC mute is 0x00020003.
772 */
773 if (unlikely((hdev->product == USB_DEVICE_ID_LENOVO_X12_TAB
774 || hdev->product == USB_DEVICE_ID_LENOVO_X12_TAB2)
775 && size >= 3 && report->id == 0x03))
> 776 return lenovo_raw_event_TP_X12_tab(hdev, le32_to_cpu(*(u32 *)data));
777
778 return 0;
779 }
780
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki