From 0150bd7f23618eb4feb293f4db007833555a887f Mon Sep 17 00:00:00 2001 From: Johan Hovold Date: Fri, 27 Mar 2015 12:41:20 +0100 Subject: [PATCH] greybus: operation: make incomplete-message errors more informative Include the operation id as well as the received and expected size (from header) when reporting incomplete messages. This information is useful when debugging communication errors. Also invert the size test to match the error message and increase readability. Signed-off-by: Johan Hovold Reviewed-by: Alex Elder Signed-off-by: Greg Kroah-Hartman --- drivers/staging/greybus/operation.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/staging/greybus/operation.c b/drivers/staging/greybus/operation.c index 878bfdb6781e..2b2b0d6332c8 100644 --- a/drivers/staging/greybus/operation.c +++ b/drivers/staging/greybus/operation.c @@ -899,8 +899,10 @@ void gb_connection_recv(struct gb_connection *connection, header = data; msg_size = le16_to_cpu(header->size); - if (msg_size > size) { - dev_err(&connection->dev, "incomplete message\n"); + if (size < msg_size) { + dev_err(&connection->dev, + "incomplete message received: 0x%04x (%zu < %zu)\n", + le16_to_cpu(header->operation_id), size, msg_size); return; /* XXX Should still complete operation */ }