Skip to content

Commit 530e5a1

Browse files
committed
Use standard validation function
1 parent 6be0a42 commit 530e5a1

File tree

1 file changed

+1
-3
lines changed
  • shared-bindings/busio

1 file changed

+1
-3
lines changed

shared-bindings/busio/I2C.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -344,9 +344,7 @@ STATIC mp_obj_t busio_i2c_writeto_then_readfrom(size_t n_args, const mp_obj_t *p
344344
int32_t in_start = args[ARG_in_start].u_int;
345345
const int32_t in_end = args[ARG_in_end].u_int;
346346
normalize_buffer_bounds(&in_start, in_end, &in_length);
347-
if (in_length == 0) {
348-
mp_raise_ValueError_varg(translate("%q length must be >= %d"), MP_QSTR_out_buffer, 1);
349-
}
347+
mp_arg_validate_length_min(in_length, 1, MP_QSTR_out_buffer);
350348

351349
uint8_t status = common_hal_busio_i2c_write_read(self, args[ARG_address].u_int,
352350
((uint8_t *)out_bufinfo.buf) + out_start, out_length,((uint8_t *)in_bufinfo.buf) + in_start, in_length);

0 commit comments

Comments
 (0)