Hi Dan,

Thanks for your report.

> Subject: [bug report] remoteproc: imx_rproc: Introduce prepare ops for
> imx_rproc_dcfg
> 
> Hello Peng Fan,
> 
> Commit edd2a9956055 ("remoteproc: imx_rproc: Introduce prepare
> ops for imx_rproc_dcfg") from Jan 9, 2026 (linux-next), leads to the
> following Smatch static checker warning:
> 
>       drivers/remoteproc/imx_rproc.c:648 imx_rproc_prepare()
>       warn: ignoring unreachable code.
> 
> drivers/remoteproc/imx_rproc.c

[...]
>     642                         return -ENOMEM;
>     643
>     644                 rproc_coredump_add_segment(rproc, da,
> resource_size(&res));
>     645                 rproc_add_carveout(rproc, mem);
>     646         }
>     647
> --> 648         if (priv->ops && priv->ops->prepare)
>     649                 return priv->ops->prepare(rproc);
> 
> This is unreachable code.

Indeed.

The i.MX95 patches were developed quite some time ago. Later, there was
another change [1] which modified the reserved-memory while-loop logic.
When rebasing my changes on top of that, I overlooked this behavior
change, which resulted in the early return making the prepare callback
unreachable.

Regarding why this was not exposed earlier during testing: NXP U-Boot
powers up the M7 (leaving it in reset) and initializes TCM ECC by default.
As a result, even without calling the platform prepare ops, Linux can
still load the M7 ELF correctly, so no issue was observed.

In hindsight, I should have tested the case where M7 remains powered off
when rebasing these changes (:

I have just sent out a fix to address this issue. Thanks again for
reporting it.

[1] 67a7bc7f0358b ("remoteproc: Use of_reserved_mem_region_* functions for 
"memory-region")

Thanks,
Peng

>     650
>     651         return 0;
>     652 }
> 
> regards,
> dan carpenter

Reply via email to