Skip to content

Commit 10ff709

Browse files
Uwe Kleine-Königrafaeljw
authored andcommitted
ACPI: AGDI: 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> Acked-by: Hanjun Guo <guohanjun@huawei.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
1 parent 9a7897a commit 10ff709

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

drivers/acpi/arm64/agdi.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ static int agdi_probe(struct platform_device *pdev)
5858
return agdi_sdei_probe(pdev, adata);
5959
}
6060

61-
static int agdi_remove(struct platform_device *pdev)
61+
static void agdi_remove(struct platform_device *pdev)
6262
{
6363
struct agdi_data *adata = dev_get_platdata(&pdev->dev);
6464
int err, i;
@@ -67,7 +67,7 @@ static int agdi_remove(struct platform_device *pdev)
6767
if (err) {
6868
dev_err(&pdev->dev, "Failed to disable sdei-event #%d (%pe)\n",
6969
adata->sdei_event, ERR_PTR(err));
70-
return 0;
70+
return;
7171
}
7272

7373
for (i = 0; i < 3; i++) {
@@ -81,16 +81,14 @@ static int agdi_remove(struct platform_device *pdev)
8181
if (err)
8282
dev_err(&pdev->dev, "Failed to unregister sdei-event #%d (%pe)\n",
8383
adata->sdei_event, ERR_PTR(err));
84-
85-
return 0;
8684
}
8785

8886
static struct platform_driver agdi_driver = {
8987
.driver = {
9088
.name = "agdi",
9189
},
9290
.probe = agdi_probe,
93-
.remove = agdi_remove,
91+
.remove_new = agdi_remove,
9492
};
9593

9694
void __init acpi_agdi_init(void)

0 commit comments

Comments
 (0)