Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Uwe Kleine-König and committed by
Uwe Kleine-König
5b495ac8 5150a8f0

+5 -9
+5 -9
drivers/vfio/platform/vfio_amba.c
··· 73 73 74 74 static int vfio_amba_remove(struct amba_device *adev) 75 75 { 76 - struct vfio_platform_device *vdev; 76 + struct vfio_platform_device *vdev = 77 + vfio_platform_remove_common(&adev->dev); 77 78 78 - vdev = vfio_platform_remove_common(&adev->dev); 79 - if (vdev) { 80 - kfree(vdev->name); 81 - kfree(vdev); 82 - return 0; 83 - } 84 - 85 - return -EINVAL; 79 + kfree(vdev->name); 80 + kfree(vdev); 81 + return 0; 86 82 } 87 83 88 84 static const struct amba_id pl330_ids[] = {