Skip to content

Commit 2595665

Browse files
Uwe Kleine-Königgregkh
authored andcommitted
firmware: arm_scpi: 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(). 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> Link: https://lore.kernel.org/r/e7b4bc389949c3613a358bd8e57d70d7acd5552b.1703693980.git.u.kleine-koenig@pengutronix.de Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 927e113 commit 2595665

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

drivers/firmware/arm_scpi.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -863,7 +863,7 @@ static void scpi_free_channels(void *data)
863863
mbox_free_channel(info->channels[i].chan);
864864
}
865865

866-
static int scpi_remove(struct platform_device *pdev)
866+
static void scpi_remove(struct platform_device *pdev)
867867
{
868868
int i;
869869
struct scpi_drvinfo *info = platform_get_drvdata(pdev);
@@ -874,8 +874,6 @@ static int scpi_remove(struct platform_device *pdev)
874874
kfree(info->dvfs[i]->opps);
875875
kfree(info->dvfs[i]);
876876
}
877-
878-
return 0;
879877
}
880878

881879
#define MAX_SCPI_XFERS 10
@@ -1048,7 +1046,7 @@ static struct platform_driver scpi_driver = {
10481046
.dev_groups = versions_groups,
10491047
},
10501048
.probe = scpi_probe,
1051-
.remove = scpi_remove,
1049+
.remove_new = scpi_remove,
10521050
};
10531051
module_platform_driver(scpi_driver);
10541052

0 commit comments

Comments
 (0)