]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/commitdiff
greybus: set result in gb_operation_response_send()
authorAlex Elder <elder@linaro.org>
Tue, 2 Dec 2014 14:30:36 +0000 (08:30 -0600)
committerGreg Kroah-Hartman <greg@kroah.com>
Tue, 2 Dec 2014 22:41:58 +0000 (14:41 -0800)
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>
drivers/staging/greybus/operation.c
drivers/staging/greybus/operation.h

index 2a6f361b877f20178f5d7f064e2ab8c838b6ee05..c80eb33f58843a30e3a00b6b36820e08697fcddb 100644 (file)
@@ -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;
index feff8238f7cfe17987a8ebed7ae7a0e69b0ae146..ed344f8de2a7dea382bdf4ca18a7e69025897fdc 100644 (file)
@@ -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);