Skip to content

Commit 6f880e7

Browse files
MrVanmathieupoirier
authored andcommitted
remoteproc: imx_dsp_rproc: Simplify start/stop error handling
Replace goto-based error handling with early return pattern in imx_dsp_rproc_{start,stop}() functions, and simplify if-else logic. No functional changes, only code structure improvements for better maintainability. Signed-off-by: Peng Fan <peng.fan@nxp.com> Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com> Reviewed-by: Frank Li <Frank.Li@nxp.com> Link: https://lore.kernel.org/r/20251119-imx-dsp-2025-11-19-v4-12-adafd342d07b@nxp.com Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
1 parent 5c33a63 commit 6f880e7

1 file changed

Lines changed: 18 additions & 21 deletions

File tree

drivers/remoteproc/imx_dsp_rproc.c

Lines changed: 18 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -376,20 +376,19 @@ static int imx_dsp_rproc_start(struct rproc *rproc)
376376
struct device *dev = rproc->dev.parent;
377377
int ret;
378378

379-
if (dcfg->ops && dcfg->ops->start) {
380-
ret = dcfg->ops->start(rproc);
381-
goto start_ret;
382-
}
383-
384-
return -EOPNOTSUPP;
379+
if (!dcfg->ops || !dcfg->ops->start)
380+
return -EOPNOTSUPP;
385381

386-
start_ret:
387-
if (ret)
382+
ret = dcfg->ops->start(rproc);
383+
if (ret) {
388384
dev_err(dev, "Failed to enable remote core!\n");
389-
else if (priv->flags & WAIT_FW_READY)
385+
return ret;
386+
}
387+
388+
if (priv->flags & WAIT_FW_READY)
390389
return imx_dsp_rproc_ready(rproc);
391390

392-
return ret;
391+
return 0;
393392
}
394393

395394
static int imx_dsp_rproc_mmio_stop(struct rproc *rproc)
@@ -431,20 +430,18 @@ static int imx_dsp_rproc_stop(struct rproc *rproc)
431430
return 0;
432431
}
433432

434-
if (dcfg->ops && dcfg->ops->stop) {
435-
ret = dcfg->ops->stop(rproc);
436-
goto stop_ret;
437-
}
438-
439-
return -EOPNOTSUPP;
433+
if (!dcfg->ops || !dcfg->ops->stop)
434+
return -EOPNOTSUPP;
440435

441-
stop_ret:
442-
if (ret)
436+
ret = dcfg->ops->stop(rproc);
437+
if (ret) {
443438
dev_err(dev, "Failed to stop remote core\n");
444-
else
445-
priv->flags &= ~REMOTE_IS_READY;
439+
return ret;
440+
}
446441

447-
return ret;
442+
priv->flags &= ~REMOTE_IS_READY;
443+
444+
return 0;
448445
}
449446

450447
/**

0 commit comments

Comments
 (0)