Skip to content

Commit de182d2

Browse files
3V3RYONEmathieupoirier
authored andcommitted
remoteproc: k3-r5: Use devm_rproc_add() helper
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 <[email protected]> Reviewed-by: Andrew Davis <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mathieu Poirier <[email protected]>
1 parent a572439 commit de182d2

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

drivers/remoteproc/ti_k3_r5_remoteproc.c

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1266,7 +1266,7 @@ static int k3_r5_cluster_rproc_init(struct platform_device *pdev)
12661266
goto out;
12671267
}
12681268

1269-
ret = rproc_add(rproc);
1269+
ret = devm_rproc_add(dev, rproc);
12701270
if (ret) {
12711271
dev_err_probe(dev, ret, "rproc_add failed\n");
12721272
goto out;
@@ -1297,7 +1297,7 @@ static int k3_r5_cluster_rproc_init(struct platform_device *pdev)
12971297
dev_err(dev,
12981298
"Timed out waiting for %s core to power up!\n",
12991299
rproc->name);
1300-
goto err_powerup;
1300+
goto out;
13011301
}
13021302
}
13031303

@@ -1313,8 +1313,6 @@ static int k3_r5_cluster_rproc_init(struct platform_device *pdev)
13131313
}
13141314
}
13151315

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

13591357
mbox_free_channel(kproc->mbox);
1360-
1361-
rproc_del(rproc);
13621358
}
13631359
}
13641360

0 commit comments

Comments
 (0)