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 <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 2a6f361..c80eb33 100644
--- a/drivers/staging/greybus/operation.c
+++ b/drivers/staging/greybus/operation.c
@@ -642,8 +642,13 @@
 /*
  * 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 feff823..ed344f8 100644
--- a/drivers/staging/greybus/operation.h
+++ b/drivers/staging/greybus/operation.h
@@ -100,7 +100,7 @@
 
 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);