Skip to content

Commit 86bc4c7

Browse files
Uwe Kleine-Königlinusw
authored andcommitted
pinctrl: stmfx: 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]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Linus Walleij <[email protected]>
1 parent a6992a0 commit 86bc4c7

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

drivers/pinctrl/pinctrl-stmfx.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -734,7 +734,7 @@ static int stmfx_pinctrl_probe(struct platform_device *pdev)
734734
return 0;
735735
}
736736

737-
static int stmfx_pinctrl_remove(struct platform_device *pdev)
737+
static void stmfx_pinctrl_remove(struct platform_device *pdev)
738738
{
739739
struct stmfx *stmfx = dev_get_drvdata(pdev->dev.parent);
740740
int ret;
@@ -746,8 +746,6 @@ static int stmfx_pinctrl_remove(struct platform_device *pdev)
746746
if (ret)
747747
dev_err(&pdev->dev, "Failed to disable pins (%pe)\n",
748748
ERR_PTR(ret));
749-
750-
return 0;
751749
}
752750

753751
#ifdef CONFIG_PM_SLEEP
@@ -856,7 +854,7 @@ static struct platform_driver stmfx_pinctrl_driver = {
856854
.pm = &stmfx_pinctrl_dev_pm_ops,
857855
},
858856
.probe = stmfx_pinctrl_probe,
859-
.remove = stmfx_pinctrl_remove,
857+
.remove_new = stmfx_pinctrl_remove,
860858
};
861859
module_platform_driver(stmfx_pinctrl_driver);
862860

0 commit comments

Comments
 (0)