Skip to content

Commit db01dfe

Browse files
committed
use a standard length validator
1 parent beb053a commit db01dfe

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

shared-module/usb_hid/__init__.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -220,9 +220,7 @@ bool common_hal_usb_hid_enable(const mp_obj_t devices, uint8_t boot_device) {
220220
}
221221

222222
const mp_int_t num_devices = MP_OBJ_SMALL_INT_VALUE(mp_obj_len(devices));
223-
if (num_devices > MAX_HID_DEVICES) {
224-
mp_raise_ValueError_varg(translate("No more than %d HID devices allowed"), MAX_HID_DEVICES);
225-
}
223+
mp_arg_validate_length_max(num_devices, MAX_HID_DEVICES, MP_QSTR_devices);
226224

227225
num_hid_devices = num_devices;
228226

0 commit comments

Comments
 (0)