]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
greybus: minor tweak in gb_connection_recv_response()
authorAlex Elder <elder@linaro.org>
Sat, 22 Nov 2014 01:29:16 +0000 (19:29 -0600)
committerGreg Kroah-Hartman <greg@kroah.com>
Sat, 22 Nov 2014 03:36:42 +0000 (19:36 -0800)
Any time we queue work on the operation work queue we need to have
set the operation errno first.

This patch moves the assignment of that field to be immediately
prior to the queue_work() call in gb_connection_recv_response(),
so it is easier to see at a glance that this has been done.

Signed-off-by: Alex Elder <elder@linaro.org>
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
drivers/staging/greybus/operation.c

index ab27cd94880af5a5ff5cc804ee0c8dc034d6a480..32cd2358ab1cb192c3fc3708e5e23d27db3121ba 100644 (file)
@@ -563,6 +563,7 @@ static void gb_connection_recv_response(struct gb_connection *connection,
        struct gb_operation *operation;
        struct gb_message *message;
        struct gb_operation_msg_hdr *header;
+       int result;
 
        operation = gb_pending_operation_find(connection, operation_id);
        if (!operation) {
@@ -577,17 +578,18 @@ static void gb_connection_recv_response(struct gb_connection *connection,
        if (size <= message->size) {
                /* Transfer the operation result from the response header */
                header = message->header;
-               operation->errno = gb_operation_status_map(header->result);
+               result = gb_operation_status_map(header->result);
        } else {
                gb_connection_err(connection, "recv buffer too small");
-               operation->errno = -E2BIG;
+               result = -E2BIG;
        }
 
        /* We must ignore the payload if a bad status is returned */
-       if (!operation->errno)
+       if (!result)
                memcpy(message->header, data, size);
 
        /* The rest will be handled in work queue context */
+       operation->errno = result;
        queue_work(gb_operation_workqueue, &operation->work);
 }