Skip to content

Commit 3f978d9

Browse files
Uwe Kleine-Königmathieupoirier
authored andcommitted
remoteproc: k3-dsp: Convert to platform remove callback returning void
The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new(), which already returns void. Eventually after all drivers are converted, .remove_new() will be renamed to .remove(). There is no change in behaviour as .remove() already returned zero unconditionally. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Link: https://lore.kernel.org/r/20231123211657.518181-8-u.kleine-koenig@pengutronix.de Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
1 parent cfd0b5c commit 3f978d9

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

drivers/remoteproc/ti_k3_dsp_remoteproc.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -815,7 +815,7 @@ static int k3_dsp_rproc_probe(struct platform_device *pdev)
815815
return ret;
816816
}
817817

818-
static int k3_dsp_rproc_remove(struct platform_device *pdev)
818+
static void k3_dsp_rproc_remove(struct platform_device *pdev)
819819
{
820820
struct k3_dsp_rproc *kproc = platform_get_drvdata(pdev);
821821
struct rproc *rproc = kproc->rproc;
@@ -827,7 +827,7 @@ static int k3_dsp_rproc_remove(struct platform_device *pdev)
827827
if (ret) {
828828
/* Note this error path leaks resources */
829829
dev_err(dev, "failed to detach proc (%pe)\n", ERR_PTR(ret));
830-
return 0;
830+
return;
831831
}
832832
}
833833

@@ -845,8 +845,6 @@ static int k3_dsp_rproc_remove(struct platform_device *pdev)
845845

846846
k3_dsp_reserved_mem_exit(kproc);
847847
rproc_free(kproc->rproc);
848-
849-
return 0;
850848
}
851849

852850
static const struct k3_dsp_mem_data c66_mems[] = {
@@ -897,7 +895,7 @@ MODULE_DEVICE_TABLE(of, k3_dsp_of_match);
897895

898896
static struct platform_driver k3_dsp_rproc_driver = {
899897
.probe = k3_dsp_rproc_probe,
900-
.remove = k3_dsp_rproc_remove,
898+
.remove_new = k3_dsp_rproc_remove,
901899
.driver = {
902900
.name = "k3-dsp-rproc",
903901
.of_match_table = k3_dsp_of_match,

0 commit comments

Comments
 (0)