summaryrefslogtreecommitdiffstats
path: root/drivers/vfio/platform
diff options
context:
space:
mode:
authorUwe Kleine-König <u.kleine-koenig@pengutronix.de>2021-01-26 17:58:33 +0100
committerUwe Kleine-König <uwe@kleine-koenig.org>2021-02-02 14:24:23 +0100
commit5b495ac8fe03b9e0d2e775f9064c3e2a340ff440 (patch)
treeb68138ae45254f03d8312335e9b6589a56fb2b72 /drivers/vfio/platform
parent5150a8f07f6c2431f12ac5a9ba07ff111d34744d (diff)
downloadlinux-5b495ac8fe03b9e0d2e775f9064c3e2a340ff440.tar.gz
linux-5b495ac8fe03b9e0d2e775f9064c3e2a340ff440.tar.bz2
linux-5b495ac8fe03b9e0d2e775f9064c3e2a340ff440.zip
vfio: platform: simplify device removal
vfio_platform_remove_common() cannot return non-NULL in vfio_amba_remove() as the latter is only called if vfio_amba_probe() returned success. Diagnosed-by: Arnd Bergmann <arnd@arndb.de> Acked-by: Eric Auger <eric.auger@redhat.com> Link: https://lore.kernel.org/r/20210126165835.687514-4-u.kleine-koenig@pengutronix.de Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Diffstat (limited to 'drivers/vfio/platform')
-rw-r--r--drivers/vfio/platform/vfio_amba.c14
1 files changed, 5 insertions, 9 deletions
diff --git a/drivers/vfio/platform/vfio_amba.c b/drivers/vfio/platform/vfio_amba.c
index 9636a2afaecd..7b3ebf1558e1 100644
--- a/drivers/vfio/platform/vfio_amba.c
+++ b/drivers/vfio/platform/vfio_amba.c
@@ -73,16 +73,12 @@ static int vfio_amba_probe(struct amba_device *adev, const struct amba_id *id)
static int vfio_amba_remove(struct amba_device *adev)
{
- struct vfio_platform_device *vdev;
-
- vdev = vfio_platform_remove_common(&adev->dev);
- if (vdev) {
- kfree(vdev->name);
- kfree(vdev);
- return 0;
- }
+ struct vfio_platform_device *vdev =
+ vfio_platform_remove_common(&adev->dev);
- return -EINVAL;
+ kfree(vdev->name);
+ kfree(vdev);
+ return 0;
}
static const struct amba_id pl330_ids[] = {