greybus: gpio: Print expected/actual payload size on mismatch

This change “greybus: gpio: Print expected/actual payload size on mismatch” in Linux kernel is authored by Viresh Kumar <viresh.kumar [at] linaro.org> on Thu Aug 6 12:44:51 2015 +0530.

greybus: gpio: Print expected/actual payload size on mismatch

Print (expected-payload-size actual-payload-size), when the size doesn't
match for requests received by the module. This gives more details
required for debugging the issue.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Reviewed-by: Alex Elder <elder@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>

This Linux change may have been applied to various maintained Linux releases and you can find Linux releases including commit 782c3b7.

There are 3 lines of Linux source code added/deleted in this change. Code changes to Linux kernel are as follows.

 drivers/staging/greybus/gpio.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/greybus/gpio.c b/drivers/staging/greybus/gpio.c
index 6539530..caee9d1 100644
--- a/drivers/staging/greybus/gpio.c
+++ b/drivers/staging/greybus/gpio.c
@@ -366,7 +366,8 @@ static int gb_gpio_request_recv(u8 type, struct gb_operation *op)
 	request = op->request;
 
 	if (request->payload_size < sizeof(*event)) {
-		dev_err(ggc->chip.dev, "short event receivedn");
+		dev_err(ggc->chip.dev, "short event received (%zu < %zu)n",
+			request->payload_size, sizeof(*event));
 		return -EINVAL;
 	}
 

The commit for this change in Linux stable tree is 782c3b7 (patch).

Leave a Reply

Your email address will not be published. Required fields are marked *