* [PATCH] remoteproc: k3-r5: Jump to error handling labels in start/stop errors
@ 2024-05-06 14:18 Beleswar Padhi
2024-05-06 19:43 ` Mathieu Poirier
0 siblings, 1 reply; 2+ messages in thread
From: Beleswar Padhi @ 2024-05-06 14:18 UTC (permalink / raw)
To: andersson
Cc: mathieu.poirier, linux-remoteproc, linux-kernel, dan.carpenter,
hnagalla, devarsht, nm, s-anna, u-kumar1
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: 3c8a9066d584 ("remoteproc: k3-r5: Do not allow core1 to power up before core0 via sysfs")
Signed-off-by: Beleswar Padhi <b-padhi@ti.com>
---
As stated in the bug-report[0], Smatch complains that:
drivers/remoteproc/ti_k3_r5_remoteproc.c:583 k3_r5_rproc_start() warn: missing unwind goto?
drivers/remoteproc/ti_k3_r5_remoteproc.c:651 k3_r5_rproc_stop() warn: missing unwind goto?
This patch addresses the warnings by jumping to appropriate error
labels in case an error occurs during start/stop operation from sysfs.
[0]-https://lore.kernel.org/all/acc4f7a0-3bb5-4842-95a5-fb3c3fc8554b@moroto.mountain/
drivers/remoteproc/ti_k3_r5_remoteproc.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/remoteproc/ti_k3_r5_remoteproc.c b/drivers/remoteproc/ti_k3_r5_remoteproc.c
index 1799b4f6d11e..50e486bcfa10 100644
--- a/drivers/remoteproc/ti_k3_r5_remoteproc.c
+++ b/drivers/remoteproc/ti_k3_r5_remoteproc.c
@@ -580,7 +580,8 @@ static int k3_r5_rproc_start(struct rproc *rproc)
if (core != core0 && core0->rproc->state == RPROC_OFFLINE) {
dev_err(dev, "%s: can not start core 1 before core 0\n",
__func__);
- return -EPERM;
+ ret = -EPERM;
+ goto put_mbox;
}
ret = k3_r5_core_run(core);
@@ -648,7 +649,8 @@ static int k3_r5_rproc_stop(struct rproc *rproc)
if (core != core1 && core1->rproc->state != RPROC_OFFLINE) {
dev_err(dev, "%s: can not stop core 0 before core 1\n",
__func__);
- return -EPERM;
+ ret = -EPERM;
+ goto out;
}
ret = k3_r5_core_halt(core);
--
2.34.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] remoteproc: k3-r5: Jump to error handling labels in start/stop errors
2024-05-06 14:18 [PATCH] remoteproc: k3-r5: Jump to error handling labels in start/stop errors Beleswar Padhi
@ 2024-05-06 19:43 ` Mathieu Poirier
0 siblings, 0 replies; 2+ messages in thread
From: Mathieu Poirier @ 2024-05-06 19:43 UTC (permalink / raw)
To: Beleswar Padhi
Cc: andersson, linux-remoteproc, linux-kernel, dan.carpenter,
hnagalla, devarsht, nm, s-anna, u-kumar1
On Mon, May 06, 2024 at 07:48:49PM +0530, Beleswar Padhi wrote:
> 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: 3c8a9066d584 ("remoteproc: k3-r5: Do not allow core1 to power up before core0 via sysfs")
>
> Signed-off-by: Beleswar Padhi <b-padhi@ti.com>
> ---
> As stated in the bug-report[0], Smatch complains that:
> drivers/remoteproc/ti_k3_r5_remoteproc.c:583 k3_r5_rproc_start() warn: missing unwind goto?
> drivers/remoteproc/ti_k3_r5_remoteproc.c:651 k3_r5_rproc_stop() warn: missing unwind goto?
>
> This patch addresses the warnings by jumping to appropriate error
> labels in case an error occurs during start/stop operation from sysfs.
>
> [0]-https://lore.kernel.org/all/acc4f7a0-3bb5-4842-95a5-fb3c3fc8554b@moroto.mountain/
>
> drivers/remoteproc/ti_k3_r5_remoteproc.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/remoteproc/ti_k3_r5_remoteproc.c b/drivers/remoteproc/ti_k3_r5_remoteproc.c
> index 1799b4f6d11e..50e486bcfa10 100644
> --- a/drivers/remoteproc/ti_k3_r5_remoteproc.c
> +++ b/drivers/remoteproc/ti_k3_r5_remoteproc.c
> @@ -580,7 +580,8 @@ static int k3_r5_rproc_start(struct rproc *rproc)
> if (core != core0 && core0->rproc->state == RPROC_OFFLINE) {
> dev_err(dev, "%s: can not start core 1 before core 0\n",
> __func__);
> - return -EPERM;
> + ret = -EPERM;
> + goto put_mbox;
> }
>
> ret = k3_r5_core_run(core);
> @@ -648,7 +649,8 @@ static int k3_r5_rproc_stop(struct rproc *rproc)
> if (core != core1 && core1->rproc->state != RPROC_OFFLINE) {
> dev_err(dev, "%s: can not stop core 0 before core 1\n",
> __func__);
> - return -EPERM;
> + ret = -EPERM;
> + goto out;
> }
Applied
Thanks,
Mathieu
>
> ret = k3_r5_core_halt(core);
> --
> 2.34.1
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-05-06 19:43 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-05-06 14:18 [PATCH] remoteproc: k3-r5: Jump to error handling labels in start/stop errors Beleswar Padhi
2024-05-06 19:43 ` Mathieu Poirier
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox