Skip to content

Commit 66d721c

Browse files
Uwe Kleine-Königlag-linaro
authored andcommitted
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 <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Lee Jones <[email protected]>
1 parent 740ad6d commit 66d721c

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

drivers/mfd/tps65911-comparator.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -140,23 +140,21 @@ static int tps65911_comparator_probe(struct platform_device *pdev)
140140
return ret;
141141
}
142142

143-
static int tps65911_comparator_remove(struct platform_device *pdev)
143+
static void tps65911_comparator_remove(struct platform_device *pdev)
144144
{
145145
struct tps65910 *tps65910;
146146

147147
tps65910 = dev_get_drvdata(pdev->dev.parent);
148148
device_remove_file(&pdev->dev, &dev_attr_comp2_threshold);
149149
device_remove_file(&pdev->dev, &dev_attr_comp1_threshold);
150-
151-
return 0;
152150
}
153151

154152
static struct platform_driver tps65911_comparator_driver = {
155153
.driver = {
156154
.name = "tps65911-comparator",
157155
},
158156
.probe = tps65911_comparator_probe,
159-
.remove = tps65911_comparator_remove,
157+
.remove_new = tps65911_comparator_remove,
160158
};
161159

162160
static int __init tps65911_comparator_init(void)

0 commit comments

Comments
 (0)