[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220405070303.721581867@linuxfoundation.org>
Date: Tue, 5 Apr 2022 09:27:38 +0200
From: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To: linux-kernel@...r.kernel.org
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
stable@...r.kernel.org, Eric Auger <eric.auger@...hat.com>,
Uwe Kleine-König
<u.kleine-koenig@...gutronix.de>, Sasha Levin <sashal@...nel.org>,
Arnd Bergmann <arnd@...db.de>
Subject: [PATCH 5.10 164/599] vfio: platform: simplify device removal
From: Uwe Kleine-König <u.kleine-koenig@...gutronix.de>
[ Upstream commit 5b495ac8fe03b9e0d2e775f9064c3e2a340ff440 ]
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@...db.de>
Acked-by: Eric Auger <eric.auger@...hat.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@...gutronix.de>
Signed-off-by: Sasha Levin <sashal@...nel.org>
---
drivers/vfio/platform/vfio_amba.c | 14 +++++---------
1 file 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[] = {
--
2.34.1
Powered by blists - more mailing lists