[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220718050914.2267370-11-tzungbi@kernel.org>
Date: Mon, 18 Jul 2022 05:09:14 +0000
From: Tzung-Bi Shih <tzungbi@...nel.org>
To: bleung@...omium.org, groeck@...omium.org
Cc: chrome-platform@...ts.linux.dev, tzungbi@...nel.org,
linux-kernel@...r.kernel.org
Subject: [PATCH v2 10/10] platform/chrome: cros_ec_proto: return -EPROTO if empty payload
cros_ec_wait_until_complete() sends EC_CMD_GET_COMMS_STATUS which expects
to receive sizeof(struct ec_response_get_comms_status) from
cros_ec_xfer_command().
Return -EPROTO if cros_ec_xfer_command() returns 0.
Reviewed-by: Guenter Roeck <groeck@...omium.org>
Signed-off-by: Tzung-Bi Shih <tzungbi@...nel.org>
---
Changes from v1:
- Add R-b tag.
drivers/platform/chrome/cros_ec_proto.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/drivers/platform/chrome/cros_ec_proto.c b/drivers/platform/chrome/cros_ec_proto.c
index 9dec475edc84..05d2e8765a66 100644
--- a/drivers/platform/chrome/cros_ec_proto.c
+++ b/drivers/platform/chrome/cros_ec_proto.c
@@ -163,6 +163,11 @@ static int cros_ec_wait_until_complete(struct cros_ec_device *ec_dev, uint32_t *
if (msg->result != EC_RES_SUCCESS)
return ret;
+ if (ret == 0) {
+ ret = -EPROTO;
+ break;
+ }
+
if (!(status->flags & EC_COMMS_STATUS_PROCESSING))
return ret;
}
--
2.37.0.170.g444d1eabd0-goog
Powered by blists - more mailing lists