* [PATCH] remoteproc: imx_rproc: Fix unreachable platform prepare_ops
@ 2026-02-08 11:30 Peng Fan (OSS)
2026-02-10 22:03 ` Mathieu Poirier
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Peng Fan (OSS) @ 2026-02-08 11:30 UTC (permalink / raw)
To: Bjorn Andersson, Mathieu Poirier, Frank Li, Sascha Hauer,
Pengutronix Kernel Team, Fabio Estevam, Daniel Baluta
Cc: linux-remoteproc, imx, linux-arm-kernel, linux-kernel, Peng Fan,
Dan Carpenter
From: Peng Fan <peng.fan@nxp.com>
Smatch reports unreachable code in imx_rproc_prepare(), where an early
return inside the reserved-memory parsing loop prevents platform
prepare_ops from being executed.
When of_reserved_mem_region_to_resource() fails, imx_rproc_prepare()
returns immediately, so the platform-specific prepare callback is never
called. As a result, prepare_ops such as imx_rproc_sm_lmm_prepare() on
i.MX95 have no chance to run.
This is problematic when Linux controls the M7 Logical Machine and is
responsible for preparing resources such as TCM. Without running the
platform prepare callback, loading the M7 ELF into TCM may fail if the
bootloader did not power up and initialize TCM.
Fix this by breaking out of the reserved-memory loop instead of
returning, allowing the platform prepare_ops to be executed as intended.
Fixes: edd2a9956055 ("remoteproc: imx_rproc: Introduce prepare ops for imx_rproc_dcfg")
Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
Closes: https://lore.kernel.org/linux-remoteproc/aYYXAa2Fj36XG4yQ@p14s/T/#t
Signed-off-by: Peng Fan <peng.fan@nxp.com>
---
drivers/remoteproc/imx_rproc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/remoteproc/imx_rproc.c b/drivers/remoteproc/imx_rproc.c
index f5f916d6790519360f446f063e09d018c5654953..8c8ddbf995a46b01627d15a2eb3da0b72eee6285 100644
--- a/drivers/remoteproc/imx_rproc.c
+++ b/drivers/remoteproc/imx_rproc.c
@@ -617,7 +617,7 @@ static int imx_rproc_prepare(struct rproc *rproc)
err = of_reserved_mem_region_to_resource(np, i++, &res);
if (err)
- return 0;
+ break;
/*
* Ignore the first memory region which will be used vdev buffer.
---
base-commit: 9845cf73f7db6094c0d8419d6adb848028f4a921
change-id: 20260208-imx-rproc-fix-843dd1031b5b
Best regards,
--
Peng Fan <peng.fan@nxp.com>
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] remoteproc: imx_rproc: Fix unreachable platform prepare_ops
2026-02-08 11:30 [PATCH] remoteproc: imx_rproc: Fix unreachable platform prepare_ops Peng Fan (OSS)
@ 2026-02-10 22:03 ` Mathieu Poirier
2026-02-11 10:28 ` Daniel Baluta
2026-02-25 16:40 ` Emanuele Ghidoli
2 siblings, 0 replies; 4+ messages in thread
From: Mathieu Poirier @ 2026-02-10 22:03 UTC (permalink / raw)
To: Peng Fan (OSS)
Cc: Bjorn Andersson, Frank Li, Sascha Hauer, Pengutronix Kernel Team,
Fabio Estevam, Daniel Baluta, linux-remoteproc, imx,
linux-arm-kernel, linux-kernel, Peng Fan, Dan Carpenter
On Sun, 8 Feb 2026 at 04:29, Peng Fan (OSS) <peng.fan@oss.nxp.com> wrote:
>
> From: Peng Fan <peng.fan@nxp.com>
>
> Smatch reports unreachable code in imx_rproc_prepare(), where an early
> return inside the reserved-memory parsing loop prevents platform
> prepare_ops from being executed.
>
> When of_reserved_mem_region_to_resource() fails, imx_rproc_prepare()
> returns immediately, so the platform-specific prepare callback is never
> called. As a result, prepare_ops such as imx_rproc_sm_lmm_prepare() on
> i.MX95 have no chance to run.
>
> This is problematic when Linux controls the M7 Logical Machine and is
> responsible for preparing resources such as TCM. Without running the
> platform prepare callback, loading the M7 ELF into TCM may fail if the
> bootloader did not power up and initialize TCM.
>
> Fix this by breaking out of the reserved-memory loop instead of
> returning, allowing the platform prepare_ops to be executed as intended.
>
> Fixes: edd2a9956055 ("remoteproc: imx_rproc: Introduce prepare ops for imx_rproc_dcfg")
> Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
> Closes: https://lore.kernel.org/linux-remoteproc/aYYXAa2Fj36XG4yQ@p14s/T/#t
> Signed-off-by: Peng Fan <peng.fan@nxp.com>
> ---
> drivers/remoteproc/imx_rproc.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/remoteproc/imx_rproc.c b/drivers/remoteproc/imx_rproc.c
> index f5f916d6790519360f446f063e09d018c5654953..8c8ddbf995a46b01627d15a2eb3da0b72eee6285 100644
> --- a/drivers/remoteproc/imx_rproc.c
> +++ b/drivers/remoteproc/imx_rproc.c
> @@ -617,7 +617,7 @@ static int imx_rproc_prepare(struct rproc *rproc)
>
> err = of_reserved_mem_region_to_resource(np, i++, &res);
> if (err)
> - return 0;
> + break;
>
I will pick this up for the next cycle.
Thanks,
Mathieu
> /*
> * Ignore the first memory region which will be used vdev buffer.
>
> ---
> base-commit: 9845cf73f7db6094c0d8419d6adb848028f4a921
> change-id: 20260208-imx-rproc-fix-843dd1031b5b
>
> Best regards,
> --
> Peng Fan <peng.fan@nxp.com>
>
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] remoteproc: imx_rproc: Fix unreachable platform prepare_ops
2026-02-08 11:30 [PATCH] remoteproc: imx_rproc: Fix unreachable platform prepare_ops Peng Fan (OSS)
2026-02-10 22:03 ` Mathieu Poirier
@ 2026-02-11 10:28 ` Daniel Baluta
2026-02-25 16:40 ` Emanuele Ghidoli
2 siblings, 0 replies; 4+ messages in thread
From: Daniel Baluta @ 2026-02-11 10:28 UTC (permalink / raw)
To: Peng Fan (OSS),
Bjorn Andersson, Mathieu Poirier, Frank Li, Sascha Hauer,
Pengutronix Kernel Team, Fabio Estevam, Daniel Baluta
Cc: linux-remoteproc, imx, linux-arm-kernel, linux-kernel, Peng Fan,
Dan Carpenter
On 2/8/26 13:30, Peng Fan (OSS) wrote:
> From: Peng Fan <peng.fan@nxp.com>
>
> Smatch reports unreachable code in imx_rproc_prepare(), where an early
> return inside the reserved-memory parsing loop prevents platform
> prepare_ops from being executed.
>
> When of_reserved_mem_region_to_resource() fails, imx_rproc_prepare()
> returns immediately, so the platform-specific prepare callback is never
> called. As a result, prepare_ops such as imx_rproc_sm_lmm_prepare() on
> i.MX95 have no chance to run.
>
> This is problematic when Linux controls the M7 Logical Machine and is
> responsible for preparing resources such as TCM. Without running the
> platform prepare callback, loading the M7 ELF into TCM may fail if the
> bootloader did not power up and initialize TCM.
>
> Fix this by breaking out of the reserved-memory loop instead of
> returning, allowing the platform prepare_ops to be executed as intended.
>
> Fixes: edd2a9956055 ("remoteproc: imx_rproc: Introduce prepare ops for imx_rproc_dcfg")
> Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
> Closes: https://lore.kernel.org/linux-remoteproc/aYYXAa2Fj36XG4yQ@p14s/T/#t
> Signed-off-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] remoteproc: imx_rproc: Fix unreachable platform prepare_ops
2026-02-08 11:30 [PATCH] remoteproc: imx_rproc: Fix unreachable platform prepare_ops Peng Fan (OSS)
2026-02-10 22:03 ` Mathieu Poirier
2026-02-11 10:28 ` Daniel Baluta
@ 2026-02-25 16:40 ` Emanuele Ghidoli
2 siblings, 0 replies; 4+ messages in thread
From: Emanuele Ghidoli @ 2026-02-25 16:40 UTC (permalink / raw)
To: Peng Fan (OSS),
Bjorn Andersson, Mathieu Poirier, Frank Li, Sascha Hauer,
Pengutronix Kernel Team, Fabio Estevam, Daniel Baluta
Cc: linux-remoteproc, imx, linux-arm-kernel, linux-kernel, Peng Fan,
Dan Carpenter
On 2/8/26 12:30, Peng Fan (OSS) wrote:
> From: Peng Fan <peng.fan@nxp.com>
>
> Smatch reports unreachable code in imx_rproc_prepare(), where an early
> return inside the reserved-memory parsing loop prevents platform
> prepare_ops from being executed.
>
> When of_reserved_mem_region_to_resource() fails, imx_rproc_prepare()
> returns immediately, so the platform-specific prepare callback is never
> called. As a result, prepare_ops such as imx_rproc_sm_lmm_prepare() on
> i.MX95 have no chance to run.
>
> This is problematic when Linux controls the M7 Logical Machine and is
> responsible for preparing resources such as TCM. Without running the
> platform prepare callback, loading the M7 ELF into TCM may fail if the
> bootloader did not power up and initialize TCM.
>
> Fix this by breaking out of the reserved-memory loop instead of
> returning, allowing the platform prepare_ops to be executed as intended.
>
> Fixes: edd2a9956055 ("remoteproc: imx_rproc: Introduce prepare ops for imx_rproc_dcfg")
> Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
> Closes: https://lore.kernel.org/linux-remoteproc/aYYXAa2Fj36XG4yQ@p14s/T/#t
> Signed-off-by: Peng Fan <peng.fan@nxp.com>
> ---
> drivers/remoteproc/imx_rproc.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/remoteproc/imx_rproc.c b/drivers/remoteproc/imx_rproc.c
> index f5f916d6790519360f446f063e09d018c5654953..8c8ddbf995a46b01627d15a2eb3da0b72eee6285 100644
> --- a/drivers/remoteproc/imx_rproc.c
> +++ b/drivers/remoteproc/imx_rproc.c
> @@ -617,7 +617,7 @@ static int imx_rproc_prepare(struct rproc *rproc)
>
> err = of_reserved_mem_region_to_resource(np, i++, &res);
> if (err)
> - return 0;
> + break;
>
> /*
> * Ignore the first memory region which will be used vdev buffer.
>
> ---
> base-commit: 9845cf73f7db6094c0d8419d6adb848028f4a921
> change-id: 20260208-imx-rproc-fix-843dd1031b5b
>
> Best regards,
Tested-by: Emanuele Ghidoli <emanuele.ghidoli@toradex.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-02-25 16:40 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-02-08 11:30 [PATCH] remoteproc: imx_rproc: Fix unreachable platform prepare_ops Peng Fan (OSS)
2026-02-10 22:03 ` Mathieu Poirier
2026-02-11 10:28 ` Daniel Baluta
2026-02-25 16:40 ` Emanuele Ghidoli
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®