Skip to content

Commit 2a21ace

Browse files
Uwe Kleine-Königgregkh
authored andcommitted
usb: musb: sunxi: 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]> Acked-by: Jernej Skrabec <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent cb020bf commit 2a21ace

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

drivers/usb/musb/sunxi.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -805,15 +805,13 @@ static int sunxi_musb_probe(struct platform_device *pdev)
805805
return ret;
806806
}
807807

808-
static int sunxi_musb_remove(struct platform_device *pdev)
808+
static void sunxi_musb_remove(struct platform_device *pdev)
809809
{
810810
struct sunxi_glue *glue = platform_get_drvdata(pdev);
811811
struct platform_device *usb_phy = glue->usb_phy;
812812

813813
platform_device_unregister(glue->musb_pdev);
814814
usb_phy_generic_unregister(usb_phy);
815-
816-
return 0;
817815
}
818816

819817
static const struct sunxi_musb_cfg sun4i_a10_musb_cfg = {
@@ -862,7 +860,7 @@ MODULE_DEVICE_TABLE(of, sunxi_musb_match);
862860

863861
static struct platform_driver sunxi_musb_driver = {
864862
.probe = sunxi_musb_probe,
865-
.remove = sunxi_musb_remove,
863+
.remove_new = sunxi_musb_remove,
866864
.driver = {
867865
.name = "musb-sunxi",
868866
.of_match_table = sunxi_musb_match,

0 commit comments

Comments
 (0)