Skip to content

Commit

Permalink
remoteproc: k3-r5: Use devm_rproc_add() helper
Browse files Browse the repository at this point in the history
Use device lifecycle managed devm_rproc_add() helper function. This
helps prevent mistakes like deleting out of order in cleanup functions
and forgetting to delete on all error paths.

Signed-off-by: Beleswar Padhi <b-padhi@ti.com>
Reviewed-by: Andrew Davis <afd@ti.com>
Link: https://lore.kernel.org/r/20241219110545.1898883-5-b-padhi@ti.com
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
  • Loading branch information
Beleswar Padhi authored and Mathieu Poirier committed Jan 6, 2025
1 parent a572439 commit de182d2
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions drivers/remoteproc/ti_k3_r5_remoteproc.c
Original file line number Diff line number Diff line change
Expand Up @@ -1266,7 +1266,7 @@ static int k3_r5_cluster_rproc_init(struct platform_device *pdev)
goto out;
}

ret = rproc_add(rproc);
ret = devm_rproc_add(dev, rproc);
if (ret) {
dev_err_probe(dev, ret, "rproc_add failed\n");
goto out;
Expand Down Expand Up @@ -1297,7 +1297,7 @@ static int k3_r5_cluster_rproc_init(struct platform_device *pdev)
dev_err(dev,
"Timed out waiting for %s core to power up!\n",
rproc->name);
goto err_powerup;
goto out;
}
}

Expand All @@ -1313,8 +1313,6 @@ static int k3_r5_cluster_rproc_init(struct platform_device *pdev)
}
}

err_powerup:
rproc_del(rproc);
out:
/* undo core0 upon any failures on core1 in split-mode */
if (cluster->mode == CLUSTER_MODE_SPLIT && core == core1) {
Expand Down Expand Up @@ -1357,8 +1355,6 @@ static void k3_r5_cluster_rproc_exit(void *data)
}

mbox_free_channel(kproc->mbox);

rproc_del(rproc);
}
}

Expand Down

0 comments on commit de182d2

Please sign in to comment.