All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] iommu/vsi: Use list_for_each_entry()
@ 2026-05-20  6:00 Dan Carpenter
  2026-05-20 12:58 ` Benjamin Gaignard
  2026-05-28  7:30 ` Joerg Roedel
  0 siblings, 2 replies; 3+ messages in thread
From: Dan Carpenter @ 2026-05-20  6:00 UTC (permalink / raw)
  To: Benjamin Gaignard
  Cc: Joerg Roedel, Will Deacon, Robin Murphy, iommu, linux-kernel,
	kernel-janitors

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>
---
Untested, but it compiled on the first try (no typos!)

 drivers/iommu/vsi-iommu.c | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/drivers/iommu/vsi-iommu.c b/drivers/iommu/vsi-iommu.c
index 5d0721bd2c7a..9954ed414526 100644
--- a/drivers/iommu/vsi-iommu.c
+++ b/drivers/iommu/vsi-iommu.c
@@ -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;
 
-- 
2.53.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-05-28  7:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-20  6:00 [PATCH] iommu/vsi: Use list_for_each_entry() Dan Carpenter
2026-05-20 12:58 ` Benjamin Gaignard
2026-05-28  7:30 ` Joerg Roedel

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.