提交 2a99a4db 编写于 作者: R Ruslan Bilovol 提交者: Yang Yingliang

usb: gadget: f_hid: fix endianness issue with descriptors

stable inclusion
from linux-4.19.198
commit 141fff551c2c0d8f98270d2e3e1c8730e00c24a1

--------------------------------

[ Upstream commit 33cb46c4 ]

Running sparse checker it shows warning message about
incorrect endianness used for descriptor initialization:

| f_hid.c:91:43: warning: incorrect type in initializer (different base types)
| f_hid.c:91:43:    expected restricted __le16 [usertype] bcdHID
| f_hid.c:91:43:    got int

Fixing issue with cpu_to_le16() macro, however this is not a real issue
as the value is the same both endians.

Cc: Fabien Chouteau <fabien.chouteau@barco.com>
Cc: Segiy Stetsyuk <serg_stetsuk@ukr.net>
Signed-off-by: NRuslan Bilovol <ruslan.bilovol@gmail.com>
Link: https://lore.kernel.org/r/20210617162755.29676-1-ruslan.bilovol@gmail.comSigned-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: NSasha Levin <sashal@kernel.org>
Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
上级 8a07e74a
...@@ -88,7 +88,7 @@ static struct usb_interface_descriptor hidg_interface_desc = { ...@@ -88,7 +88,7 @@ static struct usb_interface_descriptor hidg_interface_desc = {
static struct hid_descriptor hidg_desc = { static struct hid_descriptor hidg_desc = {
.bLength = sizeof hidg_desc, .bLength = sizeof hidg_desc,
.bDescriptorType = HID_DT_HID, .bDescriptorType = HID_DT_HID,
.bcdHID = 0x0101, .bcdHID = cpu_to_le16(0x0101),
.bCountryCode = 0x00, .bCountryCode = 0x00,
.bNumDescriptors = 0x1, .bNumDescriptors = 0x1,
/*.desc[0].bDescriptorType = DYNAMIC */ /*.desc[0].bDescriptorType = DYNAMIC */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册