Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 81ad6994 authored by Bartosz Golaszewski's avatar Bartosz Golaszewski Committed by Greg Kroah-Hartman
Browse files

greybus: loopback: allocate a response even for a 0-byte request



If payload length of a transfer packet is 0, no response is allocated.
Send a well-formed response even in that case.

Signed-off-by: default avatarBartosz Golaszewski <bgolaszewski@baylibre.com>
Reviewed-by: default avatarJohan Hovold <johan@hovoldconsulting.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@google.com>
parent 9864756b
Loading
Loading
Loading
Loading
+9 −9
Original line number Diff line number Diff line
@@ -533,7 +533,6 @@ static int gb_loopback_request_recv(u8 type, struct gb_operation *operation)
			return -EINVAL;
		}

		if (len) {
		if (!gb_operation_response_alloc(operation,
				len + sizeof(*response), GFP_KERNEL)) {
			dev_err(dev, "error allocating response\n");
@@ -541,8 +540,9 @@ static int gb_loopback_request_recv(u8 type, struct gb_operation *operation)
		}
		response = operation->response->payload;
		response->len = cpu_to_le32(len);
		if (len)
			memcpy(response->data, request->data, len);
		}

		return 0;
	default:
		dev_err(dev, "unsupported request: %hhu\n", type);