Skip to content

fishy code in shared-module/usb_hid/__init__.c #5247

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
jepler opened this issue Aug 27, 2021 · 3 comments · Fixed by #5249
Closed

fishy code in shared-module/usb_hid/__init__.c #5247

jepler opened this issue Aug 27, 2021 · 3 comments · Fixed by #5249
Labels
Milestone

Comments

@jepler
Copy link

jepler commented Aug 27, 2021

CircuitPython version

7.0 beta

Code/REPL

253         // Collect all the report buffers for this device.
254         for (size_t id_idx = 0; id_idx < hid_devices[device_idx].num_report_ids; id_idx++) {
255             gc_collect_ptr(hid_devices[id_idx].in_report_buffers[id_idx]);
256             gc_collect_ptr(hid_devices[id_idx].out_report_buffers[id_idx]);
257         }

Behavior

Scott & I spotted this while working on #5021 -- We think that the use of [id_idx] twice in each line is fishy and the first one should be [device_idx]

Description

No response

Additional information

No response

@jepler jepler added the bug label Aug 27, 2021
@jepler
Copy link
Author

jepler commented Aug 27, 2021

@dhalbert if you can take a look?

@dhalbert
Copy link
Collaborator

Yeah, that looks wrong! Thanks for spotting it!

@dhalbert dhalbert added this to the 7.0.0 milestone Aug 27, 2021
@ladyada
Copy link
Member

ladyada commented Aug 27, 2021

🦅 👀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants