Skip to content

Commit 1843671

Browse files
Uwe Kleine-Königkeithbusch
authored andcommitted
nvme-apple: 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: Keith Busch <[email protected]>
1 parent 0889d13 commit 1843671

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

drivers/nvme/host/apple.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1532,7 +1532,7 @@ static int apple_nvme_probe(struct platform_device *pdev)
15321532
return ret;
15331533
}
15341534

1535-
static int apple_nvme_remove(struct platform_device *pdev)
1535+
static void apple_nvme_remove(struct platform_device *pdev)
15361536
{
15371537
struct apple_nvme *anv = platform_get_drvdata(pdev);
15381538

@@ -1547,8 +1547,6 @@ static int apple_nvme_remove(struct platform_device *pdev)
15471547
apple_rtkit_shutdown(anv->rtk);
15481548

15491549
apple_nvme_detach_genpd(anv);
1550-
1551-
return 0;
15521550
}
15531551

15541552
static void apple_nvme_shutdown(struct platform_device *pdev)
@@ -1598,7 +1596,7 @@ static struct platform_driver apple_nvme_driver = {
15981596
.pm = pm_sleep_ptr(&apple_nvme_pm_ops),
15991597
},
16001598
.probe = apple_nvme_probe,
1601-
.remove = apple_nvme_remove,
1599+
.remove_new = apple_nvme_remove,
16021600
.shutdown = apple_nvme_shutdown,
16031601
};
16041602
module_platform_driver(apple_nvme_driver);

0 commit comments

Comments
 (0)