use a standard length validator

This commit is contained in:
Jeff Epler 2022-11-08 15:03:22 -06:00
parent beb053a94d
commit db01dfea20
No known key found for this signature in database
GPG Key ID: D5BF15AB975AB4DE
1 changed files with 1 additions and 3 deletions

View File

@ -220,9 +220,7 @@ bool common_hal_usb_hid_enable(const mp_obj_t devices, uint8_t boot_device) {
}
const mp_int_t num_devices = MP_OBJ_SMALL_INT_VALUE(mp_obj_len(devices));
if (num_devices > MAX_HID_DEVICES) {
mp_raise_ValueError_varg(translate("No more than %d HID devices allowed"), MAX_HID_DEVICES);
}
mp_arg_validate_length_max(num_devices, MAX_HID_DEVICES, MP_QSTR_devices);
num_hid_devices = num_devices;