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

This change “greybus: svc: 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:54 2015 +0530.

greybus: svc: 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 6d05ad3.

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

 drivers/staging/greybus/svc.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/greybus/svc.c b/drivers/staging/greybus/svc.c
index b89e889..4d59cbb 100644
--- a/drivers/staging/greybus/svc.c
+++ b/drivers/staging/greybus/svc.c
@@ -269,7 +269,8 @@ static int gb_svc_intf_hotplug_recv(struct gb_operation *op)
 	int ret;
 
 	if (request->payload_size < sizeof(*hotplug)) {
-		dev_err(dev, "%s: short hotplug request receivedn", __func__);
+		dev_err(dev, "%s: short hotplug request received (%zu < %zu)n",
+			__func__, request->payload_size, sizeof(*hotplug));
 		return -EINVAL;
 	}
 
@@ -372,7 +373,8 @@ static int gb_svc_intf_hot_unplug_recv(struct gb_operation *op)
 
 	if (request->payload_size < sizeof(*hot_unplug)) {
 		dev_err(&op->connection->dev,
-			"short hot unplug request receivedn");
+			"short hot unplug request received (%zu < %zu)n",
+			request->payload_size, sizeof(*hot_unplug));
 		return -EINVAL;
 	}
 
@@ -400,7 +402,8 @@ static int gb_svc_intf_reset_recv(struct gb_operation *op)
 
 	if (request->payload_size < sizeof(*reset)) {
 		dev_err(&op->connection->dev,
-			"short reset request receivedn");
+			"short reset request received (%zu < %zu)n",
+			request->payload_size, sizeof(*reset));
 		return -EINVAL;
 	}
 	reset = request->payload;

The commit for this change in Linux stable tree is 6d05ad3 (patch).

Leave a Reply

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