remoteproc: imx_dsp: Acquire runtime PM before adding carveouts

The prepare callback publishes DSP carveouts before acquiring the
runtime-PM reference that establishes required clocks and mailbox state.
A PM failure therefore leaves the prepare transaction partially
published.

Acquire runtime PM first and drop that reference if carveout
construction fails, so a failed prepare does not add resources before
its hardware prerequisite.

Fixes: ec0e5549f3 ("remoteproc: imx_dsp_rproc: Add remoteproc driver for DSP on i.MX")
Signed-off-by: Pengpeng Hou <pengpeng@iscas.ac.cn>
Link: https://lore.kernel.org/r/20260830133310.6926-1-pengpeng@iscas.ac.cn
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
This commit is contained in:
Pengpeng Hou 2026-08-30 21:33:10 +08:00 committed by Mathieu Poirier
parent 0ea61504f8
commit 13df1fa4f1

View File

@ -726,14 +726,17 @@ static int imx_dsp_rproc_prepare(struct rproc *rproc)
struct device *dev = rproc->dev.parent;
int ret;
ret = pm_runtime_resume_and_get(dev);
if (ret < 0)
return ret;
ret = imx_dsp_rproc_add_carveout(priv);
if (ret) {
dev_err(dev, "failed on imx_dsp_rproc_add_carveout\n");
pm_runtime_put_sync(dev);
return ret;
}
pm_runtime_get_sync(dev);
return 0;
}