Skip to content

Commit 9ab6fe9

Browse files
Uwe Kleine-Königgroeck
authored andcommitted
hwmon: (xgene-hwmon) 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() is 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: Guenter Roeck <[email protected]>
1 parent bc70de3 commit 9ab6fe9

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

drivers/hwmon/xgene-hwmon.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -757,7 +757,7 @@ static int xgene_hwmon_probe(struct platform_device *pdev)
757757
return rc;
758758
}
759759

760-
static int xgene_hwmon_remove(struct platform_device *pdev)
760+
static void xgene_hwmon_remove(struct platform_device *pdev)
761761
{
762762
struct xgene_hwmon_dev *ctx = platform_get_drvdata(pdev);
763763

@@ -768,8 +768,6 @@ static int xgene_hwmon_remove(struct platform_device *pdev)
768768
mbox_free_channel(ctx->mbox_chan);
769769
else
770770
pcc_mbox_free_channel(ctx->pcc_chan);
771-
772-
return 0;
773771
}
774772

775773
static const struct of_device_id xgene_hwmon_of_match[] = {
@@ -780,7 +778,7 @@ MODULE_DEVICE_TABLE(of, xgene_hwmon_of_match);
780778

781779
static struct platform_driver xgene_hwmon_driver = {
782780
.probe = xgene_hwmon_probe,
783-
.remove = xgene_hwmon_remove,
781+
.remove_new = xgene_hwmon_remove,
784782
.driver = {
785783
.name = "xgene-slimpro-hwmon",
786784
.of_match_table = xgene_hwmon_of_match,

0 commit comments

Comments
 (0)