Skip to content

Commit

Permalink
reset: tegra-bpmp: Handle errors in BPMP response
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
cyndis authored and pH5 committed Oct 5, 2021
1 parent 4af1607 commit c045ceb
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion drivers/reset/tegra/reset-bpmp.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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,
Expand Down

0 comments on commit c045ceb

Please sign in to comment.