From: Alex Elder Date: Tue, 2 Dec 2014 14:30:36 +0000 (-0600) Subject: greybus: set result in gb_operation_response_send() X-Git-Tag: v4.9-rc1~119^2~378^2~21^2~1794 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=d2d2c0fe70ff09510f56bd341e2ab415b7b5e947;p=karo-tx-linux.git greybus: set result in gb_operation_response_send() Change gb_operation_response_send() so it takes an errno to assign as an operation's result. This emphasizes that setting the result should be the last thing done to an incoming operation before sending its response. Signed-off-by: Alex Elder Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/greybus/operation.c b/drivers/staging/greybus/operation.c index 2a6f361b877f..c80eb33f5884 100644 --- a/drivers/staging/greybus/operation.c +++ b/drivers/staging/greybus/operation.c @@ -642,8 +642,13 @@ int gb_operation_request_send(struct gb_operation *operation, /* * Send a response for an incoming operation request. */ -int gb_operation_response_send(struct gb_operation *operation) +int gb_operation_response_send(struct gb_operation *operation, int errno) { + /* Record the result */ + if (!gb_operation_result_set(operation, errno)) { + pr_err("request result already set\n"); + return -EIO; /* Shouldn't happen */ + } gb_operation_destroy(operation); return 0; diff --git a/drivers/staging/greybus/operation.h b/drivers/staging/greybus/operation.h index feff8238f7cf..ed344f8de2a7 100644 --- a/drivers/staging/greybus/operation.h +++ b/drivers/staging/greybus/operation.h @@ -100,7 +100,7 @@ static inline void gb_operation_destroy(struct gb_operation *operation) int gb_operation_request_send(struct gb_operation *operation, gb_operation_callback callback); -int gb_operation_response_send(struct gb_operation *operation); +int gb_operation_response_send(struct gb_operation *operation, int errno); void gb_operation_cancel(struct gb_operation *operation, int errno);