diff --git a/drivers/vhost/vdpa.c b/drivers/vhost/vdpa.c index 35e5180b5470feca130e42d74420c12a45d61357..360baefe58f950435b363f4a1616cacb61680bd7 100644 --- a/drivers/vhost/vdpa.c +++ b/drivers/vhost/vdpa.c @@ -1683,13 +1683,13 @@ static int vhost_vdpa_release(struct inode *inode, struct file *filep) struct vhost_dev *d = &v->vdev; mutex_lock(&d->mutex); -#if IS_ENABLED(CONFIG_IOMMUFD) - vhost_vdpa_unbind_iommufd(v); -#endif filep->private_data = NULL; vhost_vdpa_clean_irq(v); vhost_vdpa_reset(v, VDPA_DEV_RESET_CLOSE); vhost_dev_stop(&v->vdev); +#if IS_ENABLED(CONFIG_IOMMUFD) + vhost_vdpa_unbind_iommufd(v); +#endif vhost_vdpa_unbind_mm(v); vhost_vdpa_config_put(v); vhost_vdpa_cleanup(v);