提交 621a7dcd 编写于 作者: U Uwe Kleine-König 提交者: Zheng Zengkai

vfio: platform: simplify device removal

stable inclusion
from stable-v5.10.110
commit 1c6ac39763bc2bbee789ad9f7f527066a50abb9a
bugzilla: https://gitee.com/openeuler/kernel/issues/I574AL

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=1c6ac39763bc2bbee789ad9f7f527066a50abb9a

--------------------------------

[ Upstream commit 5b495ac8 ]

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: NArnd Bergmann <arnd@arndb.de>
Acked-by: NEric Auger <eric.auger@redhat.com>
Link: https://lore.kernel.org/r/20210126165835.687514-4-u.kleine-koenig@pengutronix.deSigned-off-by: NUwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: NSasha Levin <sashal@kernel.org>
Signed-off-by: NYu Liao <liaoyu15@huawei.com>
Reviewed-by: NWei Li <liwei391@huawei.com>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
上级 8a70209a
...@@ -73,16 +73,12 @@ static int vfio_amba_probe(struct amba_device *adev, const struct amba_id *id) ...@@ -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) static int vfio_amba_remove(struct amba_device *adev)
{ {
struct vfio_platform_device *vdev; struct vfio_platform_device *vdev =
vfio_platform_remove_common(&adev->dev);
vdev = vfio_platform_remove_common(&adev->dev);
if (vdev) {
kfree(vdev->name);
kfree(vdev);
return 0;
}
return -EINVAL; kfree(vdev->name);
kfree(vdev);
return 0;
} }
static const struct amba_id pl330_ids[] = { static const struct amba_id pl330_ids[] = {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册