Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

extcon: intel-cht-wc: 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/87f0b8f158565cb9ea68b42db2bb018f82a7ee27.1708876186.git.u.kleine-koenig@pengutronix.de/
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>

authored by

Uwe Kleine-König and committed by
Chanwoo Choi
67d4b2ce b2da7e24

+2 -4
+2 -4
drivers/extcon/extcon-intel-cht-wc.c
··· 617 617 return ret; 618 618 } 619 619 620 - static int cht_wc_extcon_remove(struct platform_device *pdev) 620 + static void cht_wc_extcon_remove(struct platform_device *pdev) 621 621 { 622 622 struct cht_wc_extcon_data *ext = platform_get_drvdata(pdev); 623 623 624 624 cht_wc_extcon_sw_control(ext, false); 625 - 626 - return 0; 627 625 } 628 626 629 627 static const struct platform_device_id cht_wc_extcon_table[] = { ··· 632 634 633 635 static struct platform_driver cht_wc_extcon_driver = { 634 636 .probe = cht_wc_extcon_probe, 635 - .remove = cht_wc_extcon_remove, 637 + .remove_new = cht_wc_extcon_remove, 636 638 .id_table = cht_wc_extcon_table, 637 639 .driver = { 638 640 .name = "cht_wcove_pwrsrc",