Skip to content

Commit

Permalink
vfio: platform: simplify device removal
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Uwe Kleine-König authored and Uwe Kleine-König committed Feb 2, 2021
1 parent 5150a8f commit 5b495ac
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions drivers/vfio/platform/vfio_amba.c
Original file line number Diff line number Diff line change
Expand Up @@ -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[] = {
Expand Down

0 comments on commit 5b495ac

Please sign in to comment.