summaryrefslogtreecommitdiff
path: root/drivers/reset
diff options
context:
space:
mode:
authorMikko Perttunen <mperttunen@nvidia.com>2021-09-15 11:55:14 +0300
committerPhilipp Zabel <p.zabel@pengutronix.de>2021-10-05 11:55:18 +0300
commitc045ceb5a145d2a9a4bf33cbc55185ddf99f60ab (patch)
treec9331f996488f732415045e1731805bbe0765114 /drivers/reset
parent4af160707d7197d671a5b0ad9899383b6cb7c067 (diff)
downloadlinux-c045ceb5a145d2a9a4bf33cbc55185ddf99f60ab.tar.xz
reset: tegra-bpmp: Handle errors in BPMP response
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> Link: https://lore.kernel.org/r/20210915085517.1669675-2-mperttunen@nvidia.com Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Diffstat (limited to 'drivers/reset')
-rw-r--r--drivers/reset/tegra/reset-bpmp.c9
1 files changed, 8 insertions, 1 deletions
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,