Commit 1dc7242f authored by Beleswar Padhi's avatar Beleswar Padhi Committed by Mathieu Poirier

remoteproc: k3-r5: Jump to error handling labels in start/stop errors

In case of errors during core start operation from sysfs, the driver
directly returns with the -EPERM error code. Fix this to ensure that
mailbox channels are freed on error before returning by jumping to the
'put_mbox' error handling label. Similarly, jump to the 'out' error
handling label to return with required -EPERM error code during the
core stop operation from sysfs.

Fixes: 3c8a9066 ("remoteproc: k3-r5: Do not allow core1 to power up before core0 via sysfs")
Signed-off-by: default avatarBeleswar Padhi <b-padhi@ti.com>
Link: https://lore.kernel.org/r/20240506141849.1735679-1-b-padhi@ti.comSigned-off-by: default avatarMathieu Poirier <mathieu.poirier@linaro.org>
parent 47558cba
...@@ -580,7 +580,8 @@ static int k3_r5_rproc_start(struct rproc *rproc) ...@@ -580,7 +580,8 @@ static int k3_r5_rproc_start(struct rproc *rproc)
if (core != core0 && core0->rproc->state == RPROC_OFFLINE) { if (core != core0 && core0->rproc->state == RPROC_OFFLINE) {
dev_err(dev, "%s: can not start core 1 before core 0\n", dev_err(dev, "%s: can not start core 1 before core 0\n",
__func__); __func__);
return -EPERM; ret = -EPERM;
goto put_mbox;
} }
ret = k3_r5_core_run(core); ret = k3_r5_core_run(core);
...@@ -648,7 +649,8 @@ static int k3_r5_rproc_stop(struct rproc *rproc) ...@@ -648,7 +649,8 @@ static int k3_r5_rproc_stop(struct rproc *rproc)
if (core != core1 && core1->rproc->state != RPROC_OFFLINE) { if (core != core1 && core1->rproc->state != RPROC_OFFLINE) {
dev_err(dev, "%s: can not stop core 0 before core 1\n", dev_err(dev, "%s: can not stop core 0 before core 1\n",
__func__); __func__);
return -EPERM; ret = -EPERM;
goto out;
} }
ret = k3_r5_core_halt(core); ret = k3_r5_core_halt(core);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment