Skip to content

Commit d5e2c23

Browse files
Uwe Kleine-Königjwrdegoede
authored andcommitted
platform/surface: hotplug: 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]> Reviewed-by: Maximilian Luz <[email protected]> Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Hans de Goede <[email protected]> Signed-off-by: Hans de Goede <[email protected]>
1 parent 52f8a4b commit d5e2c23

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

drivers/platform/surface/surface_hotplug.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ static int shps_setup_irq(struct platform_device *pdev, enum shps_irq_type type)
183183
return 0;
184184
}
185185

186-
static int surface_hotplug_remove(struct platform_device *pdev)
186+
static void surface_hotplug_remove(struct platform_device *pdev)
187187
{
188188
struct shps_device *sdev = platform_get_drvdata(pdev);
189189
int i;
@@ -195,8 +195,6 @@ static int surface_hotplug_remove(struct platform_device *pdev)
195195

196196
mutex_destroy(&sdev->lock[i]);
197197
}
198-
199-
return 0;
200198
}
201199

202200
static int surface_hotplug_probe(struct platform_device *pdev)
@@ -261,7 +259,7 @@ MODULE_DEVICE_TABLE(acpi, surface_hotplug_acpi_match);
261259

262260
static struct platform_driver surface_hotplug_driver = {
263261
.probe = surface_hotplug_probe,
264-
.remove = surface_hotplug_remove,
262+
.remove_new = surface_hotplug_remove,
265263
.driver = {
266264
.name = "surface_hotplug",
267265
.acpi_match_table = surface_hotplug_acpi_match,

0 commit comments

Comments
 (0)