Skip to content

Commit 97e4567

Browse files
MrVanmathieupoirier
authored andcommitted
remoteproc: imx_rproc: Fix unreachable platform prepare_ops
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: edd2a99 ("remoteproc: imx_rproc: Introduce prepare ops for imx_rproc_dcfg") Reported-by: Dan Carpenter <[email protected]> Closes: https://lore.kernel.org/linux-remoteproc/aYYXAa2Fj36XG4yQ@p14s/T/#t Signed-off-by: Peng Fan <[email protected]> Reviewed-by: Daniel Baluta <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mathieu Poirier <[email protected]>
1 parent 35c3f72 commit 97e4567

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

drivers/remoteproc/imx_rproc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -617,7 +617,7 @@ static int imx_rproc_prepare(struct rproc *rproc)
617617

618618
err = of_reserved_mem_region_to_resource(np, i++, &res);
619619
if (err)
620-
return 0;
620+
break;
621621

622622
/*
623623
* Ignore the first memory region which will be used vdev buffer.

0 commit comments

Comments
 (0)