diff mbox series

[2/5] reset: tegra-bpmp: Handle errors in BPMP response

Message ID 20210915085517.1669675-2-mperttunen@nvidia.com
State Accepted
Commit c045ceb5a145d2a9a4bf33cbc55185ddf99f60ab
Headers show
Series [1/5] thermal: tegra-bpmp: Handle errors in BPMP response | expand

Commit Message

Mikko Perttunen Sept. 15, 2021, 8:55 a.m. UTC
The return value from tegra_bpmp_transfer indicates the success or
failure of the IPC transaction with BPMP. If the transaction
succeeded, we also need to check the actual command's result code.
Add code to do this.

Signed-off-by: Mikko Perttunen <mperttunen@nvidia.com>
---
 drivers/reset/tegra/reset-bpmp.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

Comments

Philipp Zabel Oct. 5, 2021, 9:55 a.m. UTC | #1
On Wed, 2021-09-15 at 11:55 +0300, Mikko Perttunen wrote:
> The return value from tegra_bpmp_transfer indicates the success or

> failure of the IPC transaction with BPMP. If the transaction

> succeeded, we also need to check the actual command's result code.

> Add code to do this.

> 

> Signed-off-by: Mikko Perttunen <mperttunen@nvidia.com>


Thank you, applied to reset/fixes.

regards
Philipp
diff mbox series

Patch

diff --git a/drivers/reset/tegra/reset-bpmp.c b/drivers/reset/tegra/reset-bpmp.c
index 24d3395964cc..4c5bba52b105 100644
--- a/drivers/reset/tegra/reset-bpmp.c
+++ b/drivers/reset/tegra/reset-bpmp.c
@@ -20,6 +20,7 @@  static int tegra_bpmp_reset_common(struct reset_controller_dev *rstc,
 	struct tegra_bpmp *bpmp = to_tegra_bpmp(rstc);
 	struct mrq_reset_request request;
 	struct tegra_bpmp_message msg;
+	int err;
 
 	memset(&request, 0, sizeof(request));
 	request.cmd = command;
@@ -30,7 +31,13 @@  static int tegra_bpmp_reset_common(struct reset_controller_dev *rstc,
 	msg.tx.data = &request;
 	msg.tx.size = sizeof(request);
 
-	return tegra_bpmp_transfer(bpmp, &msg);
+	err = tegra_bpmp_transfer(bpmp, &msg);
+	if (err)
+		return err;
+	if (msg.rx.ret)
+		return -EINVAL;
+
+	return 0;
 }
 
 static int tegra_bpmp_reset_module(struct reset_controller_dev *rstc,