Skip to content

Commit 52f8a4b

Browse files
Uwe Kleine-Königjwrdegoede
authored andcommitted
platform/surface: gpe: 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 0c84561 commit 52f8a4b

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

drivers/platform/surface/surface_gpe.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -267,20 +267,18 @@ static int surface_gpe_probe(struct platform_device *pdev)
267267
return ret;
268268
}
269269

270-
static int surface_gpe_remove(struct platform_device *pdev)
270+
static void surface_gpe_remove(struct platform_device *pdev)
271271
{
272272
struct surface_lid_device *lid = dev_get_drvdata(&pdev->dev);
273273

274274
/* restore default behavior without this module */
275275
surface_lid_enable_wakeup(&pdev->dev, false);
276276
acpi_disable_gpe(NULL, lid->gpe_number);
277-
278-
return 0;
279277
}
280278

281279
static struct platform_driver surface_gpe_driver = {
282280
.probe = surface_gpe_probe,
283-
.remove = surface_gpe_remove,
281+
.remove_new = surface_gpe_remove,
284282
.driver = {
285283
.name = "surface_gpe",
286284
.pm = &surface_gpe_pm,

0 commit comments

Comments
 (0)