Skip to content

Commit da84267

Browse files
Uwe Kleine-Königmathieupoirier
authored andcommitted
remoteproc: mtk_scp: 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 (mostly) ignored 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. Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> Reviewed-by: Matthias Brugger <matthias.bgg@gmail.com> Link: https://lore.kernel.org/r/20230504194453.1150368-7-u.kleine-koenig@pengutronix.de Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
1 parent ad12305 commit da84267

1 file changed

Lines changed: 2 additions & 4 deletions

File tree

drivers/remoteproc/mtk_scp.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -913,7 +913,7 @@ static int scp_probe(struct platform_device *pdev)
913913
return ret;
914914
}
915915

916-
static int scp_remove(struct platform_device *pdev)
916+
static void scp_remove(struct platform_device *pdev)
917917
{
918918
struct mtk_scp *scp = platform_get_drvdata(pdev);
919919
int i;
@@ -925,8 +925,6 @@ static int scp_remove(struct platform_device *pdev)
925925
for (i = 0; i < SCP_IPI_MAX; i++)
926926
mutex_destroy(&scp->ipi_desc[i].lock);
927927
mutex_destroy(&scp->send_lock);
928-
929-
return 0;
930928
}
931929

932930
static const struct mtk_scp_of_data mt8183_of_data = {
@@ -1003,7 +1001,7 @@ MODULE_DEVICE_TABLE(of, mtk_scp_of_match);
10031001

10041002
static struct platform_driver mtk_scp_driver = {
10051003
.probe = scp_probe,
1006-
.remove = scp_remove,
1004+
.remove_new = scp_remove,
10071005
.driver = {
10081006
.name = "mtk-scp",
10091007
.of_match_table = mtk_scp_of_match,

0 commit comments

Comments
 (0)