Commit 7f31129d authored by Daniel Schultz's avatar Daniel Schultz Committed by Benjamin Cabé
Browse files

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: default avatarDaniel Schultz <d.schultz@phytec.de>
parent 801792b4
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -69,13 +69,13 @@ static int cmd_uart_read(const struct shell *sh, size_t argc, char **argv)
		}
		if (ret != 0 && ret != -1) {
			shell_error(sh, "Failed to read from UART (%d)", ret);
			break;
			return ret;
		}
	}

	shell_fprintf_normal(sh, "\n");

	return ret;
	return 0;
}