File tree Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -160,11 +160,13 @@ bool common_hal_usb_hid_enable(const mp_obj_t devices) {
160
160
return false;
161
161
}
162
162
163
- hid_devices_num = MP_OBJ_SMALL_INT_VALUE (mp_obj_len (devices ));
164
- if (hid_devices_num > MAX_HID_DEVICES ) {
163
+ const mp_int_t num_devices = MP_OBJ_SMALL_INT_VALUE (mp_obj_len (devices ));
164
+ if (num_devices > MAX_HID_DEVICES ) {
165
165
mp_raise_ValueError_varg (translate ("No more than %d HID devices allowed" ), MAX_HID_DEVICES );
166
166
}
167
167
168
+ hid_devices_num = num_devices ;
169
+
168
170
// Remember the devices in static storage so they live across VMs.
169
171
for (mp_int_t i = 0 ; i < hid_devices_num ; i ++ ) {
170
172
// devices has already been validated to contain only usb_hid_device_obj_t objects.
You can’t perform that action at this time.
0 commit comments