Skip to content

Commit dc5f9f5

Browse files
arndbJiri Kosina
authored andcommitted
HID: i2c-hid: fix format string mismatch
clang doesn't like printing a 32-bit integer using %hX format string: drivers/hid/i2c-hid/i2c-hid-core.c:994:18: error: format specifies type 'unsigned short' but the argument has type '__u32' (aka 'unsigned int') [-Werror,-Wformat] client->name, hid->vendor, hid->product); ^~~~~~~~~~~ drivers/hid/i2c-hid/i2c-hid-core.c:994:31: error: format specifies type 'unsigned short' but the argument has type '__u32' (aka 'unsigned int') [-Werror,-Wformat] client->name, hid->vendor, hid->product); ^~~~~~~~~~~~ Use an explicit cast to truncate it to the low 16 bits instead. Fixes: 9ee3e06 ("HID: i2c-hid: override HID descriptors for certain devices") Signed-off-by: Arnd Bergmann <[email protected]> Reviewed-by: Nathan Chancellor <[email protected]> Signed-off-by: Jiri Kosina <[email protected]>
1 parent 5ad755f commit dc5f9f5

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/hid/i2c-hid/i2c-hid-core.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -997,8 +997,8 @@ int i2c_hid_core_probe(struct i2c_client *client, struct i2chid_ops *ops,
997997
hid->vendor = le16_to_cpu(ihid->hdesc.wVendorID);
998998
hid->product = le16_to_cpu(ihid->hdesc.wProductID);
999999

1000-
snprintf(hid->name, sizeof(hid->name), "%s %04hX:%04hX",
1001-
client->name, hid->vendor, hid->product);
1000+
snprintf(hid->name, sizeof(hid->name), "%s %04X:%04X",
1001+
client->name, (u16)hid->vendor, (u16)hid->product);
10021002
strlcpy(hid->phys, dev_name(&client->dev), sizeof(hid->phys));
10031003

10041004
ihid->quirks = i2c_hid_lookup_quirk(hid->vendor, hid->product);

0 commit comments

Comments
 (0)