8000 zephyr/machine_uart: Use mp_obj_str_get_str to get device name. · micropython/micropython@6c67fbc · GitHub
[go: up one dir, main page]

Skip to content

Commit 6c67fbc

Browse files
committed
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>
1 parent 787bd99 commit 6c67fbc

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

ports/zephyr/machine_uart.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,10 +75,9 @@ STATIC void machine_uart_init_helper(machine_uart_obj_t *self, size_t n_args, co
7575

7676
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) {
7777
mp_arg_check_num(n_args, n_kw, 1, MP_OBJ_FUN_ARGS_MAX, true);
78-
GET_STR_DATA_LEN(args[0], name, name_len);
7978

8079
machine_uart_obj_t *self = mp_obj_malloc(machine_uart_obj_t, &machine_uart_type);
81-
self->dev = device_get_binding(name);
80+
self->dev = device_get_binding(mp_obj_str_get_str(args[0]));
8281
if (!self->dev) {
8382
mp_raise_ValueError(MP_ERROR_TEXT("Bad device name"));
8483
}

0 commit comments

Comments
 (0)
0