Commit 563bd79b authored by Bryan O'Donoghue's avatar Bryan O'Donoghue Committed by Greg Kroah-Hartman

greybus: uart: send_data should return size or error

gb_operation_sync returns 0 on success but the calling function
expects the number of bytes written on success or a negative errno
Signed-off-by: default avatarBryan O'Donoghue <bryan.odonoghue@linaro.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@google.com>
parent f95ad78c
...@@ -71,7 +71,7 @@ define_get_version(gb_tty, UART); ...@@ -71,7 +71,7 @@ define_get_version(gb_tty, UART);
static int send_data(struct gb_tty *tty, u16 size, const u8 *data) static int send_data(struct gb_tty *tty, u16 size, const u8 *data)
{ {
struct gb_uart_send_data_request *request; struct gb_uart_send_data_request *request;
int retval; int ret;
if (!data || !size) if (!data || !size)
return 0; return 0;
...@@ -82,11 +82,13 @@ static int send_data(struct gb_tty *tty, u16 size, const u8 *data) ...@@ -82,11 +82,13 @@ static int send_data(struct gb_tty *tty, u16 size, const u8 *data)
request->size = cpu_to_le16(size); request->size = cpu_to_le16(size);
memcpy(&request->data[0], data, size); memcpy(&request->data[0], data, size);
retval = gb_operation_sync(tty->connection, GB_UART_TYPE_SEND_DATA, ret = gb_operation_sync(tty->connection, GB_UART_TYPE_SEND_DATA,
request, sizeof(*request) + size, NULL, 0); request, sizeof(*request) + size, NULL, 0);
kfree(request); kfree(request);
return retval; if (ret)
return ret;
else
return size;
} }
static int send_line_coding(struct gb_tty *tty) static int send_line_coding(struct gb_tty *tty)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment