diff options
author | Bryan O'Donoghue <bryan.odonoghue@linaro.org> | 2015-06-02 13:40:48 +0100 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@google.com> | 2015-06-04 14:08:22 +0900 |
commit | 563bd79b2ddd12dd9da89635dc218d6c706a4130 (patch) | |
tree | 6086b2096cd428338c9c30697f61f2c0a2a755b4 /drivers/staging/greybus/uart.c | |
parent | f95ad78c72e72bcc922e75b80b35c6e9549b9d72 (diff) | |
download | op-kernel-dev-563bd79b2ddd12dd9da89635dc218d6c706a4130.zip op-kernel-dev-563bd79b2ddd12dd9da89635dc218d6c706a4130.tar.gz |
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: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Diffstat (limited to 'drivers/staging/greybus/uart.c')
-rw-r--r-- | drivers/staging/greybus/uart.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/drivers/staging/greybus/uart.c b/drivers/staging/greybus/uart.c index c47667d..928b83d 100644 --- a/drivers/staging/greybus/uart.c +++ b/drivers/staging/greybus/uart.c @@ -71,7 +71,7 @@ define_get_version(gb_tty, UART); static int send_data(struct gb_tty *tty, u16 size, const u8 *data) { struct gb_uart_send_data_request *request; - int retval; + int ret; if (!data || !size) return 0; @@ -82,11 +82,13 @@ static int send_data(struct gb_tty *tty, u16 size, const u8 *data) request->size = cpu_to_le16(size); memcpy(&request->data[0], data, size); - retval = gb_operation_sync(tty->connection, GB_UART_TYPE_SEND_DATA, - request, sizeof(*request) + size, NULL, 0); - + ret = gb_operation_sync(tty->connection, GB_UART_TYPE_SEND_DATA, + request, sizeof(*request) + size, NULL, 0); kfree(request); - return retval; + if (ret) + return ret; + else + return size; } static int send_line_coding(struct gb_tty *tty) |