Skip to content

Commit 58b1519

Browse files
Uwe Kleine-KönigTzung-Bi Shih
authored andcommitted
platform/chrome: cros_ec_vbc: 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]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Tzung-Bi Shih <[email protected]>
1 parent 6478e30 commit 58b1519

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

drivers/platform/chrome/cros_ec_vbc.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -121,22 +121,20 @@ static int cros_ec_vbc_probe(struct platform_device *pd)
121121
return ret;
122122
}
123123

124-
static int cros_ec_vbc_remove(struct platform_device *pd)
124+
static void cros_ec_vbc_remove(struct platform_device *pd)
125125
{
126126
struct cros_ec_dev *ec_dev = dev_get_drvdata(pd->dev.parent);
127127

128128
sysfs_remove_group(&ec_dev->class_dev.kobj,
129129
&cros_ec_vbc_attr_group);
130-
131-
return 0;
132130
}
133131

134132
static struct platform_driver cros_ec_vbc_driver = {
135133
.driver = {
136134
.name = DRV_NAME,
137135
},
138136
.probe = cros_ec_vbc_probe,
139-
.remove = cros_ec_vbc_remove,
137+
.remove_new = cros_ec_vbc_remove,
140138
};
141139

142140
module_platform_driver(cros_ec_vbc_driver);

0 commit comments

Comments
 (0)