# \[PATCH\] firmware: arm\_scmi: Add delayed response status check

- Subsystems: SYSTEM CONTROL \& POWER/MANAGEMENT INTERFACE (SCPI/SCMI) Message Protocol drivers, THE REST
- Maintainers: Sudeep Holla, Linus Torvalds
- Status: LANDED (f1748b1ee1fa · 2021-06-08 14:10)
- Landed in mainline as f1748b1ee1fa on 2021-06-08.
- List: linux-arm-kernel
- 2 messages, 2 authors
- Page: https://ratatoskr.run/linux-arm-kernel/2021/06/1406258/t

## \[PATCH\] firmware: arm\_scmi: Add delayed response status check

- From: Cristian Marussi \<cristian.marussi@arm.com\>
- Date: 2021-06-08 10:31:40 
- Message: https://ratatoskr.run/linux-arm-kernel/2021/06/1406258.md

```text
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.

Fixes: 58ecdf03dbb9 ("firmware: arm_scmi: Add support for asynchronous commands and delayed response")
Signed-off-by: Cristian Marussi <cristian.marussi@arm.com>
---
 drivers/firmware/arm_scmi/driver.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/firmware/arm_scmi/driver.c b/drivers/firmware/arm_scmi/driver.c
index 759ae4a23e74..6826d516e4eb 100644
--- a/drivers/firmware/arm_scmi/driver.c
+++ b/drivers/firmware/arm_scmi/driver.c
@@ -519,8 +519,12 @@ static int do_xfer_with_response(const struct scmi_protocol_handle *ph,
 	xfer->async_done = &async_response;
 
 	ret = do_xfer(ph, 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;
-- 
2.17.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
```

## Re: \[PATCH\] firmware: arm\_scmi: Add delayed response status check

- From: Sudeep Holla \<hidden\>
- Date: 2021-06-09 20:46:44 
- Message: https://ratatoskr.run/linux-arm-kernel/2021/06/1409124.md

```text
On Tue, 8 Jun 2021 11:30:56 +0100, Cristian Marussi wrote:
> 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.

Applied to sudeep.holla/linux (master), thanks!

[1/1] firmware: arm_scmi: Add delayed response status check
      https://git.kernel.org/sudeep.holla/c/f1748b1ee1

--
Regards,
Sudeep


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
```
