Skip to content

Commit da22084

Browse files
Uwe Kleine-Königrafaeljw
authored andcommitted
ACPI: DPTF: 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 these two drivers 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> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
1 parent 10ff709 commit da22084

File tree

2 files changed

+4
-8
lines changed

2 files changed

+4
-8
lines changed

drivers/acpi/dptf/dptf_pch_fivr.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -141,11 +141,9 @@ static int pch_fivr_add(struct platform_device *pdev)
141141
return 0;
142142
}
143143

144-
static int pch_fivr_remove(struct platform_device *pdev)
144+
static void pch_fivr_remove(struct platform_device *pdev)
145145
{
146146
sysfs_remove_group(&pdev->dev.kobj, &pch_fivr_attribute_group);
147-
148-
return 0;
149147
}
150148

151149
static const struct acpi_device_id pch_fivr_device_ids[] = {
@@ -159,7 +157,7 @@ MODULE_DEVICE_TABLE(acpi, pch_fivr_device_ids);
159157

160158
static struct platform_driver pch_fivr_driver = {
161159
.probe = pch_fivr_add,
162-
.remove = pch_fivr_remove,
160+
.remove_new = pch_fivr_remove,
163161
.driver = {
164162
.name = "dptf_pch_fivr",
165163
.acpi_match_table = pch_fivr_device_ids,

drivers/acpi/dptf/dptf_power.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ static int dptf_power_add(struct platform_device *pdev)
209209
return 0;
210210
}
211211

212-
static int dptf_power_remove(struct platform_device *pdev)
212+
static void dptf_power_remove(struct platform_device *pdev)
213213
{
214214
struct acpi_device *acpi_dev = platform_get_drvdata(pdev);
215215

@@ -221,8 +221,6 @@ static int dptf_power_remove(struct platform_device *pdev)
221221
sysfs_remove_group(&pdev->dev.kobj, &dptf_battery_attribute_group);
222222
else
223223
sysfs_remove_group(&pdev->dev.kobj, &dptf_power_attribute_group);
224-
225-
return 0;
226224
}
227225

228226
static const struct acpi_device_id int3407_device_ids[] = {
@@ -242,7 +240,7 @@ MODULE_DEVICE_TABLE(acpi, int3407_device_ids);
242240

243241
static struct platform_driver dptf_power_driver = {
244242
.probe = dptf_power_add,
245-
.remove = dptf_power_remove,
243+
.remove_new = dptf_power_remove,
246244
.driver = {
247245
.name = "dptf_power",
248246
.acpi_match_table = int3407_device_ids,

0 commit comments

Comments
 (0)