Skip to content

Commit 48f2c68

Browse files
Uwe Kleine-Königkees
authored andcommitted
pstore/ram: 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 <[email protected]> Reviewed-by: Guilherme G. Piccoli <[email protected]> Signed-off-by: Kees Cook <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent ac9a786 commit 48f2c68

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

fs/pstore/ram.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -875,7 +875,7 @@ static int ramoops_probe(struct platform_device *pdev)
875875
return err;
876876
}
877877

878-
static int ramoops_remove(struct platform_device *pdev)
878+
static void ramoops_remove(struct platform_device *pdev)
879879
{
880880
struct ramoops_context *cxt = &oops_cxt;
881881

@@ -885,8 +885,6 @@ static int ramoops_remove(struct platform_device *pdev)
885885
cxt->pstore.bufsize = 0;
886886

887887
ramoops_free_przs(cxt);
888-
889-
return 0;
890888
}
891889

892890
static const struct of_device_id dt_match[] = {
@@ -896,7 +894,7 @@ static const struct of_device_id dt_match[] = {
896894

897895
static struct platform_driver ramoops_driver = {
898896
.probe = ramoops_probe,
899-
.remove = ramoops_remove,
897+
.remove_new = ramoops_remove,
900898
.driver = {
901899
.name = "ramoops",
902900
.of_match_table = dt_match,

0 commit comments

Comments
 (0)