Skip to content

Commit c741ccf

Browse files
Uwe Kleine-KönigIngo Molnar
authored andcommitted
x86/platform/olpc-x01-pm: 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]> Signed-off-by: Ingo Molnar <[email protected]> Link: https://lore.kernel.org/r/c7d669d8b0c994c77fb4c3bc7bec78aeb8659c74.1712732665.git.u.kleine-koenig@pengutronix.de
1 parent bcc0403 commit c741ccf

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

arch/x86/platform/olpc/olpc-xo1-pm.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -144,31 +144,30 @@ static int xo1_pm_probe(struct platform_device *pdev)
144144
return 0;
145145
}
146146

147-
static int xo1_pm_remove(struct platform_device *pdev)
147+
static void xo1_pm_remove(struct platform_device *pdev)
148148
{
149149
if (strcmp(pdev->name, "cs5535-pms") == 0)
150150
pms_base = 0;
151151
else if (strcmp(pdev->name, "olpc-xo1-pm-acpi") == 0)
152152
acpi_base = 0;
153153

154154
pm_power_off = NULL;
155-
return 0;
156155
}
157156

158157
static struct platform_driver cs5535_pms_driver = {
159158
.driver = {
160159
.name = "cs5535-pms",
161160
},
162161
.probe = xo1_pm_probe,
163-
.remove = xo1_pm_remove,
162+
.remove_new = xo1_pm_remove,
164163
};
165164

166165
static struct platform_driver cs5535_acpi_driver = {
167166
.driver = {
168167
.name = "olpc-xo1-pm-acpi",
169168
},
170169
.probe = xo1_pm_probe,
171-
.remove = xo1_pm_remove,
170+
.remove_new = xo1_pm_remove,
172171
};
173172

174173
static int __init xo1_pm_init(void)

0 commit comments

Comments
 (0)