Skip to contentSkip to conversation

virtio-iommu: Remove useless !sdev check in virtio_iommu_probe()

PATCH In review Eric Auger 2 participants 2 messages Nov 9, 2023

lore
Share & tools
lore

Eric Auger

author
#0 lore raw

PATCH 1/1 virtio-iommu: Remove useless !sdev check in virtio_iommu_probe()

The code already checks iommu_mr is not NULL so there is no need to check container_of() is not NULL. Remove the check.

Fixes CID 1523901
Fixes 09b4c3d6a2 ("virtio-iommu: Record whether a probe request has

been issued")

Reported-by Coverity (CID 1523901)
---
 hw/virtio/virtio-iommu.c | 3 ---
 1 file changed, 3 deletions(-)
hw/virtio/virtio-iommu.c +0 -3
index 89fb5767d1..9d463efc52 100644
@@ -698,9 +698,6 @@ static int virtio_iommu_probe(VirtIOIOMMU *s,
     }
 
     sdev = container_of(iommu_mr, IOMMUDevice, iommu_mr);
-    if (!sdev) {
-        return -EINVAL;
-    }
 
     count = virtio_iommu_fill_resv_mem_prop(sdev, ep_id, buf, free);
     if (count < 0) {
Signature · 1 line
2.41.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 9 lines · Eric Auger

The code already checks iommu_mr is not NULL so there is no need to check container_of() is not NULL. Remove the check.

Fixes CID 1523901
Fixes 09b4c3d6a2 ("virtio-iommu: Record whether a probe request has

been issued")

Reported-by Coverity (CID 1523901)

thanks
-- PMM