10000 Merge remote-tracking branch 'origin/main' into main · farnja/circuitpython@d78467d · GitHub
[go: up one dir, main page]

Skip to content

Commit d78467d

Browse files
committed
Merge remote-tracking branch 'origin/main' into main
2 parents cb6b834 + 7190b3e commit d78467d

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

shared-module/usb_hid/__init__.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -259,9 +259,14 @@ void usb_hid_save_report_descriptor(uint8_t *report_descriptor_space, size_t rep
259259
void usb_hid_gc_collect(void) {
260260
gc_collect_ptr(hid_devices_tuple);
261261

262-
// Mark any heap pointers in the static device list as in use.
262+
// Mark possible heap pointers in the static device list as in use.
263263
for (mp_int_t i = 0; i < num_hid_devices; i++) {
264-
gc_collect_ptr(&hid_devices[i]);
264+
// Cast away the const for .report_descriptor. It could be in flash or on the heap.
265+
// Constant report descriptors must be const so that they are used directly from flash
266+
// and not copied into RAM.
267+
gc_collect_ptr((void *)hid_devices[i].report_descriptor);
268+
gc_collect_ptr(hid_devices[i].in_report_buffer);
269+
gc_collect_ptr(hid_devices[i].out_report_buffer);
265270
}
266271
}
267272

0 commit comments

Comments
 (0)
0