Commit 1a365154 authored by Alex Elder's avatar Alex Elder Committed by Greg Kroah-Hartman

greybus: fix some error codes

Change the message result values used in two cases.

First, use -EMSGSIZE rather than -E2BIG to represent a message
that is larger than the buffer intended to hold it.  That is
the proper code for this situation.

Second, use -ECANCELED rather than -EINTR for an operation that
has been canceled.  The definition of that error is literally
"Operation Canceled" so it seems like the right thing to do.
Signed-off-by: default avatarAlex Elder <elder@linaro.org>
Signed-off-by: default avatarGreg Kroah-Hartman <greg@kroah.com>
parent 3deb37d4
...@@ -324,7 +324,7 @@ int gb_operation_status_map(u8 status) ...@@ -324,7 +324,7 @@ int gb_operation_status_map(u8 status)
case GB_OP_PROTOCOL_BAD: case GB_OP_PROTOCOL_BAD:
return -EPROTONOSUPPORT; return -EPROTONOSUPPORT;
case GB_OP_OVERFLOW: case GB_OP_OVERFLOW:
return -E2BIG; return -EMSGSIZE;
case GB_OP_TIMEOUT: case GB_OP_TIMEOUT:
return -ETIMEDOUT; return -ETIMEDOUT;
default: default:
...@@ -510,7 +510,7 @@ int gb_operation_request_send(struct gb_operation *operation, ...@@ -510,7 +510,7 @@ int gb_operation_request_send(struct gb_operation *operation,
/* Cancel the operation if interrupted */ /* Cancel the operation if interrupted */
ret = wait_for_completion_interruptible(&operation->completion); ret = wait_for_completion_interruptible(&operation->completion);
if (ret < 0) if (ret < 0)
gb_operation_cancel(operation, -EINTR); gb_operation_cancel(operation, -ECANCELED);
return gb_operation_result(operation); return gb_operation_result(operation);
} }
...@@ -605,7 +605,7 @@ static void gb_connection_recv_response(struct gb_connection *connection, ...@@ -605,7 +605,7 @@ static void gb_connection_recv_response(struct gb_connection *connection,
result = gb_operation_status_map(header->result); result = gb_operation_status_map(header->result);
} else { } else {
gb_connection_err(connection, "recv buffer too small"); gb_connection_err(connection, "recv buffer too small");
result = -E2BIG; result = -EMSGSIZE;
} }
/* We must ignore the payload if a bad status is returned */ /* We must ignore the payload if a bad status is returned */
......
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