Skip to contentSkip to conversation

Hid: wacom: Fix kernel test robot warning

PATCH In review Joshua Dickens 2 participants 2 messages Apr 30, 2022 – May 6, 2022

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Hid: wacom: Fix kernel test robot warning

From: Joshua-Dickens <[email protected]>

Kernel test robot throws the following warning -

Quoted 1 line
Quoted 1 line

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.

---
 drivers/hid/wacom_wac.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hid/wacom_wac.c +1 -1
index 64fe573deb9b..9470c2b0b529 100644
@@ -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;
 	}
Signature · 1 line
2.35.1
maintainer
#1 lore raw
Quoted 21 lines · Joshua Dickens

From: Joshua-Dickens <[email protected]>

Kernel test robot throws the following warning -

Quoted 1 line
Quoted 1 line

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.

---
 drivers/hid/wacom_wac.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hid/wacom_wac.c +0 -0
index 64fe573deb9b..9470c2b0b529 100644

drivers/hid/wacom_wac.c static void wacom_wac_pen_event(struct hid_device *hdev, struct hid_field *field · line 2413

Quoted 7 lines
drivers/hid/wacom_wac.c +1 -1
@@ -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;

Applied on top of the pile in for-5.19/wacom, thanks Joshua.

Signature · 2 lines
Jiri Kosina
SUSE Labs