Skip to content

Commit c341ac6

Browse files
Uwe Kleine-Königlinusw
authored andcommitted
pinctrl: sprd-sc9860: 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(). To convert the sprd-sc9860 driver, make sprd_pinctrl_remove() return void (instead of zero) and use .remove_new as callback. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Link: https://lore.kernel.org/r/20231009162510.335208-4-u.kleine-koenig@pengutronix.de Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
1 parent 22ee670 commit c341ac6

File tree

3 files changed

+3
-4
lines changed

3 files changed

+3
-4
lines changed

drivers/pinctrl/sprd/pinctrl-sprd-sc9860.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -943,7 +943,7 @@ static struct platform_driver sprd_pinctrl_driver = {
943943
.of_match_table = sprd_pinctrl_of_match,
944944
},
945945
.probe = sprd_pinctrl_probe,
946-
.remove = sprd_pinctrl_remove,
946+
.remove_new = sprd_pinctrl_remove,
947947
.shutdown = sprd_pinctrl_shutdown,
948948
};
949949
module_platform_driver(sprd_pinctrl_driver);

drivers/pinctrl/sprd/pinctrl-sprd.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1110,12 +1110,11 @@ int sprd_pinctrl_core_probe(struct platform_device *pdev,
11101110
}
11111111
EXPORT_SYMBOL_GPL(sprd_pinctrl_core_probe);
11121112

1113-
int sprd_pinctrl_remove(struct platform_device *pdev)
1113+
void sprd_pinctrl_remove(struct platform_device *pdev)
11141114
{
11151115
struct sprd_pinctrl *sprd_pctl = platform_get_drvdata(pdev);
11161116

11171117
pinctrl_unregister(sprd_pctl->pctl);
1118-
return 0;
11191118
}
11201119
EXPORT_SYMBOL_GPL(sprd_pinctrl_remove);
11211120

drivers/pinctrl/sprd/pinctrl-sprd.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ struct sprd_pins_info {
5353
int sprd_pinctrl_core_probe(struct platform_device *pdev,
5454
struct sprd_pins_info *sprd_soc_pin_info,
5555
int pins_cnt);
56-
int sprd_pinctrl_remove(struct platform_device *pdev);
56+
void sprd_pinctrl_remove(struct platform_device *pdev);
5757
void sprd_pinctrl_shutdown(struct platform_device *pdev);
5858

5959
#endif /* __PINCTRL_SPRD_H__ */

0 commit comments

Comments
 (0)