Skip to content

Commit b5c4881

Browse files
author
Benjamin Tissoires
committed
Merge branch 'for-6.11/core' into for-linus
Couple of fixes for HID-core: - use of kvzalloc in case memory gets too fragmented (Hailong Liu) - retrieve the device firmware node in the child HID device (Danny Kaehn)
2 parents 22c0a46 + b81881b commit b5c4881

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

drivers/hid/hid-core.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -95,9 +95,9 @@ static struct hid_field *hid_register_field(struct hid_report *report, unsigned
9595
return NULL;
9696
}
9797

98-
field = kzalloc((sizeof(struct hid_field) +
99-
usages * sizeof(struct hid_usage) +
100-
3 * usages * sizeof(unsigned int)), GFP_KERNEL);
98+
field = kvzalloc((sizeof(struct hid_field) +
99+
usages * sizeof(struct hid_usage) +
100+
3 * usages * sizeof(unsigned int)), GFP_KERNEL);
101101
if (!field)
102102
return NULL;
103103

@@ -661,7 +661,7 @@ static void hid_free_report(struct hid_report *report)
661661
kfree(report->field_entries);
662662

663663
for (n = 0; n < report->maxfield; n++)
664-
kfree(report->field[n]);
664+
kvfree(report->field[n]);
665665
kfree(report);
666666
}
667667

drivers/hid/usbhid/hid-core.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#include <linux/list.h>
2020
#include <linux/mm.h>
2121
#include <linux/mutex.h>
22+
#include <linux/property.h>
2223
#include <linux/spinlock.h>
2324
#include <asm/unaligned.h>
2425
#include <asm/byteorder.h>
@@ -1374,6 +1375,7 @@ static int usbhid_probe(struct usb_interface *intf, const struct usb_device_id *
13741375
hid->hiddev_report_event = hiddev_report_event;
13751376
#endif
13761377
hid->dev.parent = &intf->dev;
1378+
device_set_node(&hid->dev, dev_fwnode(&intf->dev));
13771379
hid->bus = BUS_USB;
13781380
hid->vendor = le16_to_cpu(dev->descriptor.idVendor);
13791381
hid->product = le16_to_cpu(dev->descriptor.idProduct);

0 commit comments

Comments
 (0)