summaryrefslogtreecommitdiff
path: root/drivers/staging/greybus/operation.c
diff options
context:
space:
mode:
authorJohan Hovold <johan@hovoldconsulting.com>2016-02-25 14:40:23 +0100
committerGreg Kroah-Hartman <gregkh@google.com>2016-02-25 16:26:58 -0800
commit34804efb0c25d189bd9aa6e495a3bf5d778a0299 (patch)
treeed49b1d8661fe5d218ed8086492324c2ad1efe74 /drivers/staging/greybus/operation.c
parentd2320b2dbf95216e9aedf69345862f934ae55138 (diff)
greybus: operation: add temporary pointer to response handler
As a preparatory clean up, add a temporary variable to point to the response message header. Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Tested-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Johan Hovold <johan@hovoldconsulting.com> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Diffstat (limited to 'drivers/staging/greybus/operation.c')
-rw-r--r--drivers/staging/greybus/operation.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/drivers/staging/greybus/operation.c b/drivers/staging/greybus/operation.c
index bd79f81da020..9de548d1a05c 100644
--- a/drivers/staging/greybus/operation.c
+++ b/drivers/staging/greybus/operation.c
@@ -858,6 +858,7 @@ static void gb_connection_recv_request(struct gb_connection *connection,
static void gb_connection_recv_response(struct gb_connection *connection,
u16 operation_id, u8 result, void *data, size_t size)
{
+ struct gb_operation_msg_hdr *header;
struct gb_operation *operation;
struct gb_message *message;
int errno = gb_operation_status_map(result);
@@ -872,11 +873,12 @@ static void gb_connection_recv_response(struct gb_connection *connection,
}
message = operation->response;
- message_size = sizeof(*message->header) + message->payload_size;
+ header = message->header;
+ message_size = sizeof(*header) + message->payload_size;
if (!errno && size != message_size) {
dev_err(&connection->hd->dev,
"%s: malformed response 0x%02x received (%zu != %zu)\n",
- connection->name, message->header->type, size,
+ connection->name, header->type, size,
message_size);
errno = -EMSGSIZE;
}
@@ -884,11 +886,11 @@ static void gb_connection_recv_response(struct gb_connection *connection,
/* We must ignore the payload if a bad status is returned */
if (errno)
- size = sizeof(*message->header);
+ size = sizeof(*header);
/* The rest will be handled in work queue context */
if (gb_operation_result_set(operation, errno)) {
- memcpy(message->header, data, size);
+ memcpy(header, data, size);
queue_work(gb_operation_completion_wq, &operation->work);
}