Skip to content

Commit 0d1a7a8

Browse files
Uwe Kleine-Königkuba-moo
authored andcommitted
net: wan: framer/pef2256: 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 <[email protected]> Acked-by: Herve Codina <[email protected]> Link: https://lore.kernel.org/r/9684419fd714cc489a3ef36d838d3717bb6aec6d.1709886922.git.u.kleine-koenig@pengutronix.de Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 838b6c9 commit 0d1a7a8

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

drivers/net/wan/framer/pef2256/pef2256.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -838,7 +838,7 @@ static int pef2256_probe(struct platform_device *pdev)
838838
return 0;
839839
}
840840

841-
static int pef2256_remove(struct platform_device *pdev)
841+
static void pef2256_remove(struct platform_device *pdev)
842842
{
843843
struct pef2256 *pef2256 = platform_get_drvdata(pdev);
844844

@@ -849,8 +849,6 @@ static int pef2256_remove(struct platform_device *pdev)
849849
pef2256_write8(pef2256, PEF2256_IMR3, 0xff);
850850
pef2256_write8(pef2256, PEF2256_IMR4, 0xff);
851851
pef2256_write8(pef2256, PEF2256_IMR5, 0xff);
852-
853-
return 0;
854852
}
855853

856854
static const struct of_device_id pef2256_id_table[] = {
@@ -865,7 +863,7 @@ static struct platform_driver pef2256_driver = {
865863
.of_match_table = pef2256_id_table,
866864
},
867865
.probe = pef2256_probe,
868-
.remove = pef2256_remove,
866+
.remove_new = pef2256_remove,
869867
};
870868
module_platform_driver(pef2256_driver);
871869

0 commit comments

Comments
 (0)