[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220615051248.1628156-12-tzungbi@kernel.org>
Date: Wed, 15 Jun 2022 05:12:48 +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 11/11] 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.
Signed-off-by: Tzung-Bi Shih <tzungbi@...nel.org>
---
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 5323edddb540..0c7042aa2640 100644
--- a/drivers/platform/chrome/cros_ec_proto.c
+++ b/drivers/platform/chrome/cros_ec_proto.c
@@ -166,6 +166,11 @@ static int cros_ec_wait_until_complete(struct cros_ec_device *ec_dev, uint32_t *
break;
}
+ if (ret == 0) {
+ ret = -EPROTO;
+ break;
+ }
+
if (!(status->flags & EC_COMMS_STATUS_PROCESSING))
break;
}
--
2.36.1.476.g0c4daa206d-goog
Powered by blists - more mailing lists