summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorDamien George <damien@micropython.org>2022-08-11 21:44:53 +1000
committerDamien George <damien@micropython.org>2022-08-11 23:18:02 +1000
commit6c67fbc280625c59fff7cdf93f16d5e2ad0bad8a (patch)
treecc520dfb535b4b3ecceb6ad0b7526275dc7a2401
parent787bd9991903dc736b5eb79826dd34e4c17f72ec (diff)
downloadmicropython-6c67fbc280625c59fff7cdf93f16d5e2ad0bad8a.tar.gz
micropython-6c67fbc280625c59fff7cdf93f16d5e2ad0bad8a.zip
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 <damien@micropython.org>
-rw-r--r--ports/zephyr/machine_uart.c3
1 files changed, 1 insertions, 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"));
}