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>
This commit is contained in:
Uwe Kleine-König 2023-11-23 22:17:01 +01:00 committed by Mathieu Poirier
parent cfd0b5c4fd
commit 3f978d9889

View File

@ -815,7 +815,7 @@ free_rproc:
return ret;
}
static int k3_dsp_rproc_remove(struct platform_device *pdev)
static void k3_dsp_rproc_remove(struct platform_device *pdev)
{
struct k3_dsp_rproc *kproc = platform_get_drvdata(pdev);
struct rproc *rproc = kproc->rproc;
@ -827,7 +827,7 @@ static int k3_dsp_rproc_remove(struct platform_device *pdev)
if (ret) {
/* Note this error path leaks resources */
dev_err(dev, "failed to detach proc (%pe)\n", ERR_PTR(ret));
return 0;
return;
}
}
@ -845,8 +845,6 @@ static int k3_dsp_rproc_remove(struct platform_device *pdev)
k3_dsp_reserved_mem_exit(kproc);
rproc_free(kproc->rproc);
return 0;
}
static const struct k3_dsp_mem_data c66_mems[] = {
@ -897,7 +895,7 @@ MODULE_DEVICE_TABLE(of, k3_dsp_of_match);
static struct platform_driver k3_dsp_rproc_driver = {
.probe = k3_dsp_rproc_probe,
.remove = k3_dsp_rproc_remove,
.remove_new = k3_dsp_rproc_remove,
.driver = {
.name = "k3-dsp-rproc",
.of_match_table = k3_dsp_of_match,