Skip to content

Commit 7f31129

Browse files
dnltzkartben
authored andcommitted
driver: serial: uart_shell: read: Return correct return code
Always return exit code 0 when cmd_uart_read stopped reading data from UART. Instead, return with a error code in case reading from the UART interface failed. Currently, this command might return with exit code -1 because uart_poll_in didn't return data and the read duration expired. Signed-off-by: Daniel Schultz <d.schultz@phytec.de>
1 parent 801792b commit 7f31129

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/serial/uart_shell.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,13 +69,13 @@ static int cmd_uart_read(const struct shell *sh, size_t argc, char **argv)
6969
}
7070
if (ret != 0 && ret != -1) {
7171
shell_error(sh, "Failed to read from UART (%d)", ret);
72-
break;
72+
return ret;
7373
}
7474
}
7575

7676
shell_fprintf_normal(sh, "\n");
7777

78-
return ret;
78+
return 0;
7979
}
8080

8181

0 commit comments

Comments
 (0)