vfio: Reverse test on vfio_get_xlat_addr()

It will simplify the changes coming after.

Reviewed-by: Avihai Horon <avihaih@nvidia.com>
Reviewed-by: Eric Auger <eric.auger@redhat.com>
Signed-off-by: Cédric Le Goater <clg@redhat.com>
This commit is contained in:
Cédric Le Goater 2024-05-16 14:46:55 +02:00
parent 3783f814e7
commit 94d1208840
1 changed files with 13 additions and 9 deletions

View File

@ -1224,7 +1224,10 @@ static void vfio_iommu_map_dirty_notify(IOMMUNotifier *n, IOMMUTLBEntry *iotlb)
}
rcu_read_lock();
if (vfio_get_xlat_addr(iotlb, NULL, &translated_addr, NULL)) {
if (!vfio_get_xlat_addr(iotlb, NULL, &translated_addr, NULL)) {
goto out_unlock;
}
ret = vfio_get_dirty_bitmap(bcontainer, iova, iotlb->addr_mask + 1,
translated_addr);
if (ret) {
@ -1233,7 +1236,8 @@ static void vfio_iommu_map_dirty_notify(IOMMUNotifier *n, IOMMUTLBEntry *iotlb)
bcontainer, iova, iotlb->addr_mask + 1, ret,
strerror(-ret));
}
}
out_unlock:
rcu_read_unlock();
out: