Skip to content

Commit 9b27b11

Browse files
Uwe Kleine-Königawilliam
authored andcommitted
vfio/platform: 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 <u.kleine-koenig@pengutronix.de> Reviewed-by: Jason Gunthorpe <jgg@nvidia.com> Reviewed-by: Eric Auger <eric.auger@redhat.com> Link: https://lore.kernel.org/r/79d3df42fe5b359a05b8061631e72e5ed249b234.1709886922.git.u.kleine-koenig@pengutronix.de Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
1 parent 821b8f6 commit 9b27b11

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

drivers/vfio/platform/vfio_platform.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,14 +85,13 @@ static void vfio_platform_release_dev(struct vfio_device *core_vdev)
8585
vfio_platform_release_common(vdev);
8686
}
8787

88-
static int vfio_platform_remove(struct platform_device *pdev)
88+
static void vfio_platform_remove(struct platform_device *pdev)
8989
{
9090
struct vfio_platform_device *vdev = dev_get_drvdata(&pdev->dev);
9191

9292
vfio_unregister_group_dev(&vdev->vdev);
9393
pm_runtime_disable(vdev->device);
9494
vfio_put_device(&vdev->vdev);
95-
return 0;
9695
}
9796

9897
static const struct vfio_device_ops vfio_platform_ops = {
@@ -113,7 +112,7 @@ static const struct vfio_device_ops vfio_platform_ops = {
113112

114113
static struct platform_driver vfio_platform_driver = {
115114
.probe = vfio_platform_probe,
116-
.remove = vfio_platform_remove,
115+
.remove_new = vfio_platform_remove,
117116
.driver = {
118117
.name = "vfio-platform",
119118
},

0 commit comments

Comments
 (0)