Replace manual rproc_add() and cleanup logic with devm_rproc_add(), which
ties the remoteproc lifecycle to the device's lifecycle. This simplifies
error handling and ensures proper cleanup.

With no need to invoke rproc_del(), the remove() ops could be removed.

No functional changes.

Reviewed-by: Frank Li <[email protected]>
Reviewed-by: Daniel Baluta <[email protected]>
Signed-off-by: Peng Fan <[email protected]>
---
 drivers/remoteproc/imx_rproc.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/remoteproc/imx_rproc.c b/drivers/remoteproc/imx_rproc.c
index 
76feda868cb619b79922bcee4c6fdb3e16fc81e3..68e01b647b66910627fb2256c96c152f3c22c83b
 100644
--- a/drivers/remoteproc/imx_rproc.c
+++ b/drivers/remoteproc/imx_rproc.c
@@ -1135,7 +1135,7 @@ static int imx_rproc_probe(struct platform_device *pdev)
                        return dev_err_probe(dev, ret, "pm_runtime get 
failed\n");
        }
 
-       ret = rproc_add(rproc);
+       ret = devm_rproc_add(dev, rproc);
        if (ret) {
                dev_err(dev, "rproc_add failed\n");
                goto err_put_pm;
@@ -1161,7 +1161,6 @@ static void imx_rproc_remove(struct platform_device *pdev)
                pm_runtime_disable(priv->dev);
                pm_runtime_put_noidle(priv->dev);
        }
-       rproc_del(rproc);
 }
 
 static const struct imx_rproc_plat_ops imx_rproc_ops_arm_smc = {

-- 
2.37.1


Reply via email to