[PATCH v1 03/18] vfio/ccw: Ensure mdev->dev is cleared on mdev remove

Eric Farman
2022-06-02T17:20:13Z

The mdev is linked with the vfio_ccw_private pointer when the mdev
is probed, but it's not cleared once the mdev is removed.

This isn't much of a concern based on the current device lifecycle,
but fix it so that things make sense in later shuffling.

Fixes: 3bf1311f351ef ("vfio/ccw: Convert to use vfio_register_emulated_iommu_dev()")
Signed-off-by: Eric Farman <farman@linux.ibm.com>
---
drivers/s390/cio/vfio_ccw_ops.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/drivers/s390/cio/vfio_ccw_ops.c b/drivers/s390/cio/vfio_ccw_ops.c
index a403d059a4e6..a0a3200b0b04 100644
--- a/drivers/s390/cio/vfio_ccw_ops.c
+++ b/drivers/s390/cio/vfio_ccw_ops.c
@@ -159,6 +159,7 @@ static void vfio_ccw_mdev_remove(struct mdev_device *mdev)
private->sch->schid.ssid,
private->sch->schid.sch_no);

+ dev_set_drvdata(&mdev->dev, NULL);
vfio_unregister_group_dev(&private->vdev);

if ((private->state != VFIO_CCW_STATE_NOT_OPER) &&
--
2.32.0