]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
iommu/vsi: Use list_for_each_entry()
authorDan Carpenter <error27@gmail.com>
Wed, 20 May 2026 06:00:23 +0000 (09:00 +0300)
committerJoerg Roedel <joerg.roedel@amd.com>
Thu, 28 May 2026 07:30:34 +0000 (09:30 +0200)
Smatch complains about the NULL check on "iommu" because list_entry()
can't be NULL.  Clean up this code by using list_for_each_entry().

Signed-off-by: Dan Carpenter <error27@gmail.com>
Reviewed-by: Benjamin Gaignard <benjamin.gaignard@collabora.com>
Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
drivers/iommu/vsi-iommu.c

index 23913720d4840ab6b7700f6388dc5b2e4afd7781..42c424496d0739cd461d8407c4401beedb6ee06f 100644 (file)
@@ -366,15 +366,9 @@ static int vsi_iommu_map_iova(struct vsi_iommu_domain *vsi_domain, u32 *pte_addr
 static void vsi_iommu_flush_tlb(struct iommu_domain *domain)
 {
        struct vsi_iommu_domain *vsi_domain = to_vsi_domain(domain);
-       struct list_head *pos;
-
-       list_for_each(pos, &vsi_domain->iommus) {
-               struct vsi_iommu *iommu;
-
-               iommu = list_entry(pos, struct vsi_iommu, node);
-               if (!iommu)
-                       continue;
+       struct vsi_iommu *iommu;
 
+       list_for_each_entry(iommu, &vsi_domain->iommus, node) {
                if (pm_runtime_get(iommu->dev) < 0)
                        continue;