Skip to content

Commit 4cf16b6

Browse files
Uwe Kleine-Königandersson
authored andcommitted
hwspinlock: omap: 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 (mostly) ignored 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. 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]> Acked-by: Baolin Wang <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Bjorn Andersson <[email protected]>
1 parent 72a3a50 commit 4cf16b6

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

drivers/hwspinlock/omap_hwspinlock.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -145,20 +145,18 @@ static int omap_hwspinlock_probe(struct platform_device *pdev)
145145
return ret;
146146
}
147147

148-
static int omap_hwspinlock_remove(struct platform_device *pdev)
148+
static void omap_hwspinlock_remove(struct platform_device *pdev)
149149
{
150150
struct hwspinlock_device *bank = platform_get_drvdata(pdev);
151151
int ret;
152152

153153
ret = hwspin_lock_unregister(bank);
154154
if (ret) {
155155
dev_err(&pdev->dev, "%s failed: %d\n", __func__, ret);
156-
return 0;
156+
return;
157157
}
158158

159159
pm_runtime_disable(&pdev->dev);
160-
161-
return 0;
162160
}
163161

164162
static const struct of_device_id omap_hwspinlock_of_match[] = {
@@ -171,7 +169,7 @@ MODULE_DEVICE_TABLE(of, omap_hwspinlock_of_match);
171169

172170
static struct platform_driver omap_hwspinlock_driver = {
173171
.probe = omap_hwspinlock_probe,
174-
.remove = omap_hwspinlock_remove,
172+
.remove_new = omap_hwspinlock_remove,
175173
.driver = {
176174
.name = "omap_hwspinlock",
177175
.of_match_table = omap_hwspinlock_of_match,

0 commit comments

Comments
 (0)