]> git.baikalelectronics.ru Git - kernel.git/commitdiff
Hid: wacom: Fix kernel test robot warning
authorJoshua-Dickens <Joshua@Joshua-Dickens.com>
Sat, 30 Apr 2022 00:01:34 +0000 (17:01 -0700)
committerJiri Kosina <jkosina@suse.cz>
Fri, 6 May 2022 06:36:28 +0000 (08:36 +0200)
Kernel test robot throws the following warning -
>> drivers/hid/wacom_wac.c:2411:42: warning: format specifies type 'unsigned short' but the argument has type 'int' [-Wformat]
                           hid_warn(hdev, "Dropped %hu packets", value - wacom_wac->hid_data.sequence_number);
                                                   ~~~           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                                                   %d

Explicitly casting the argument to unsigned short to silence the warning and retain the intended behavior.

Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Joshua Dickens <joshua.dickens@wacom.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
drivers/hid/wacom_wac.c

index 64fe573deb9b3952cd6f7eb0061aec37d1afbce6..9470c2b0b52945bab3bf153679d9d295063f81c2 100644 (file)
@@ -2408,7 +2408,7 @@ static void wacom_wac_pen_event(struct hid_device *hdev, struct hid_field *field
                return;
        case WACOM_HID_WD_SEQUENCENUMBER:
                if (wacom_wac->hid_data.sequence_number != value)
-                       hid_warn(hdev, "Dropped %hu packets", value - wacom_wac->hid_data.sequence_number);
+                       hid_warn(hdev, "Dropped %hu packets", (unsigned short)(value - wacom_wac->hid_data.sequence_number));
                wacom_wac->hid_data.sequence_number = value + 1;
                return;
        }