From 3c20b5f95f4fd7e656193072ba97378360a6655f Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Fri, 20 May 2022 00:04:49 -0400 Subject: [PATCH] use validator in mimx UART constructor --- ports/mimxrt10xx/common-hal/busio/UART.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/ports/mimxrt10xx/common-hal/busio/UART.c b/ports/mimxrt10xx/common-hal/busio/UART.c index 8615002811..9f801a2f65 100644 --- a/ports/mimxrt10xx/common-hal/busio/UART.c +++ b/ports/mimxrt10xx/common-hal/busio/UART.c @@ -113,12 +113,9 @@ void common_hal_busio_uart_construct(busio_uart_obj_t *self, bool sigint_enabled) { self->baudrate = baudrate; - self->character_bits = bits; + self->character_bits = (uint8_t)mp_arg_validate_int_range(self->character_bits, 7, 8, MP_QSTR_bits); self->timeout_ms = timeout * 1000; - if (self->character_bits != 7 && self->character_bits != 8) { - mp_arg_validate_int_range(self->character_bits, 7, 8, MP_QSTR_bits); - } DBGPrintf(&mp_plat_print, "uart_construct: tx:%p rx:%p rts:%p cts:%p rs485:%p\n", tx, rx, rts, cts, rs485_dir);