diff mbox series

firmware: arm_scmi: Add delayed response status check

Message ID 20210804113555.9021-1-cristian.marussi@arm.com
State New
Headers show
Series firmware: arm_scmi: Add delayed response status check | expand

Commit Message

Cristian Marussi Aug. 4, 2021, 11:35 a.m. UTC
[ Upstream commit f1748b1ee1fa0fd1a074504045b530b62f949188 ]

A successfully received delayed response could anyway report a failure at
the protocol layer in the message status field.

Add a check also for this error condition.

Cc: <stable@vger.kernel.org> # v5.4+
Link: https://lore.kernel.org/r/20210608103056.3388-1-cristian.marussi@arm.com
Fixes: 58ecdf03dbb9 ("firmware: arm_scmi: Add support for asynchronous commands and delayed response")
Signed-off-by: Cristian Marussi <cristian.marussi@arm.com>
Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
---
Upstream commit f1748b1ee1fa0fd1a074504045b530b62f949188 has been already
applied to stable/linux-5.13.y, this is a backport with conflicts resolved
for v5.4 and v5.10 (The code fixed here was introduced after v4.19)
---
 drivers/firmware/arm_scmi/driver.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

Comments

Greg KH Aug. 6, 2021, 6:24 a.m. UTC | #1
On Wed, Aug 04, 2021 at 12:35:55PM +0100, Cristian Marussi wrote:
> [ Upstream commit f1748b1ee1fa0fd1a074504045b530b62f949188 ]

> 

> A successfully received delayed response could anyway report a failure at

> the protocol layer in the message status field.

> 

> Add a check also for this error condition.

> 

> Cc: <stable@vger.kernel.org> # v5.4+

> Link: https://lore.kernel.org/r/20210608103056.3388-1-cristian.marussi@arm.com

> Fixes: 58ecdf03dbb9 ("firmware: arm_scmi: Add support for asynchronous commands and delayed response")

> Signed-off-by: Cristian Marussi <cristian.marussi@arm.com>

> Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>

> ---

> Upstream commit f1748b1ee1fa0fd1a074504045b530b62f949188 has been already

> applied to stable/linux-5.13.y, this is a backport with conflicts resolved

> for v5.4 and v5.10 (The code fixed here was introduced after v4.19)


All now queued up, thanks.

greg k-h
diff mbox series

Patch

diff --git a/drivers/firmware/arm_scmi/driver.c b/drivers/firmware/arm_scmi/driver.c
index 48e6e2b48924..4e43bdfa041f 100644
--- a/drivers/firmware/arm_scmi/driver.c
+++ b/drivers/firmware/arm_scmi/driver.c
@@ -515,8 +515,12 @@  int scmi_do_xfer_with_response(const struct scmi_handle *handle,
 	xfer->async_done = &async_response;
 
 	ret = scmi_do_xfer(handle, xfer);
-	if (!ret && !wait_for_completion_timeout(xfer->async_done, timeout))
-		ret = -ETIMEDOUT;
+	if (!ret) {
+		if (!wait_for_completion_timeout(xfer->async_done, timeout))
+			ret = -ETIMEDOUT;
+		else if (xfer->hdr.status)
+			ret = scmi_to_linux_errno(xfer->hdr.status);
+	}
 
 	xfer->async_done = NULL;
 	return ret;