Skip to content

Commit 5be3dfe

Browse files
Uwe Kleine-Königchanwoochoi
authored andcommitted
extcon: usb-gpio: 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. Link: https://lore.kernel.org/lkml/8914cd71b32e1f6298e65b84fb84370c73b4fe37.1708876186.git.u.kleine-koenig@pengutronix.de/ Signed-off-by: Uwe Kleine-König <[email protected]> Signed-off-by: Chanwoo Choi <[email protected]>
1 parent 9688b1d commit 5be3dfe

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

drivers/extcon/extcon-usb-gpio.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -193,14 +193,12 @@ static int usb_extcon_probe(struct platform_device *pdev)
193193
return 0;
194194
}
195195

196-
static int usb_extcon_remove(struct platform_device *pdev)
196+
static void usb_extcon_remove(struct platform_device *pdev)
197197
{
198198
struct usb_extcon_info *info = platform_get_drvdata(pdev);
199199

200200
cancel_delayed_work_sync(&info->wq_detcable);
201201
device_init_wakeup(&pdev->dev, false);
202-
203-
return 0;
204202
}
205203

206204
#ifdef CONFIG_PM_SLEEP
@@ -281,7 +279,7 @@ MODULE_DEVICE_TABLE(platform, usb_extcon_platform_ids);
281279

282280
static struct platform_driver usb_extcon_driver = {
283281
.probe = usb_extcon_probe,
284-
.remove = usb_extcon_remove,
282+
.remove_new = usb_extcon_remove,
285283
.driver = {
286284
.name = "extcon-usb-gpio",
287285
.pm = &usb_extcon_pm_ops,

0 commit comments

Comments
 (0)