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

Configure Feed

Select the types of activity you want to include in your feed.

mfd: tps65911-comparator: 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 <u.kleine-koenig@pengutronix.de>
Link: https://lore.kernel.org/r/20231123165627.492259-18-u.kleine-koenig@pengutronix.de
Signed-off-by: Lee Jones <lee@kernel.org>

authored by

Uwe Kleine-König and committed by
Lee Jones
66d721ca 740ad6d1

+2 -4
+2 -4
drivers/mfd/tps65911-comparator.c
··· 140 140 return ret; 141 141 } 142 142 143 - static int tps65911_comparator_remove(struct platform_device *pdev) 143 + static void tps65911_comparator_remove(struct platform_device *pdev) 144 144 { 145 145 struct tps65910 *tps65910; 146 146 147 147 tps65910 = dev_get_drvdata(pdev->dev.parent); 148 148 device_remove_file(&pdev->dev, &dev_attr_comp2_threshold); 149 149 device_remove_file(&pdev->dev, &dev_attr_comp1_threshold); 150 - 151 - return 0; 152 150 } 153 151 154 152 static struct platform_driver tps65911_comparator_driver = { ··· 154 156 .name = "tps65911-comparator", 155 157 }, 156 158 .probe = tps65911_comparator_probe, 157 - .remove = tps65911_comparator_remove, 159 + .remove_new = tps65911_comparator_remove, 158 160 }; 159 161 160 162 static int __init tps65911_comparator_init(void)