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: Alex Elder <elder@linaro.org>
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
diff --git a/drivers/staging/greybus/operation.c b/drivers/staging/greybus/operation.c
index 82fd7e9..5e5c097 100644
--- a/drivers/staging/greybus/operation.c
+++ b/drivers/staging/greybus/operation.c
@@ -324,7 +324,7 @@
case GB_OP_PROTOCOL_BAD:
return -EPROTONOSUPPORT;
case GB_OP_OVERFLOW:
- return -E2BIG;
+ return -EMSGSIZE;
case GB_OP_TIMEOUT:
return -ETIMEDOUT;
default:
@@ -510,7 +510,7 @@
/* Cancel the operation if interrupted */
ret = wait_for_completion_interruptible(&operation->completion);
if (ret < 0)
- gb_operation_cancel(operation, -EINTR);
+ gb_operation_cancel(operation, -ECANCELED);
return gb_operation_result(operation);
}
@@ -605,7 +605,7 @@
result = gb_operation_status_map(header->result);
} else {
gb_connection_err(connection, "recv buffer too small");
- result = -E2BIG;
+ result = -EMSGSIZE;
}
/* We must ignore the payload if a bad status is returned */