Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Mikko Perttunen and committed by
Philipp Zabel
c045ceb5 4af16070

+8 -1
+8 -1
drivers/reset/tegra/reset-bpmp.c
··· 20 20 struct tegra_bpmp *bpmp = to_tegra_bpmp(rstc); 21 21 struct mrq_reset_request request; 22 22 struct tegra_bpmp_message msg; 23 + int err; 23 24 24 25 memset(&request, 0, sizeof(request)); 25 26 request.cmd = command; ··· 31 30 msg.tx.data = &request; 32 31 msg.tx.size = sizeof(request); 33 32 34 - return tegra_bpmp_transfer(bpmp, &msg); 33 + err = tegra_bpmp_transfer(bpmp, &msg); 34 + if (err) 35 + return err; 36 + if (msg.rx.ret) 37 + return -EINVAL; 38 + 39 + return 0; 35 40 } 36 41 37 42 static int tegra_bpmp_reset_module(struct reset_controller_dev *rstc,