From 6c67fbc280625c59fff7cdf93f16d5e2ad0bad8a Mon Sep 17 00:00:00 2001 From: Damien George Date: Thu, 11 Aug 2022 21:44:53 +1000 Subject: [PATCH] zephyr/machine_uart: Use mp_obj_str_get_str to get device name. This checks that the argument is actually a string. Signed-off-by: Damien George --- ports/zephyr/machine_uart.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/ports/zephyr/machine_uart.c b/ports/zephyr/machine_uart.c index 47ca0945a5..3520795c5a 100644 --- a/ports/zephyr/machine_uart.c +++ b/ports/zephyr/machine_uart.c @@ -75,10 +75,9 @@ STATIC void machine_uart_init_helper(machine_uart_obj_t *self, size_t n_args, co STATIC mp_obj_t machine_uart_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) { mp_arg_check_num(n_args, n_kw, 1, MP_OBJ_FUN_ARGS_MAX, true); - GET_STR_DATA_LEN(args[0], name, name_len); machine_uart_obj_t *self = mp_obj_malloc(machine_uart_obj_t, &machine_uart_type); - self->dev = device_get_binding(name); + self->dev = device_get_binding(mp_obj_str_get_str(args[0])); if (!self->dev) { mp_raise_ValueError(MP_ERROR_TEXT("Bad device name")); }