[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20251209071513.3105610-1-pengcan@kylinos.cn>
Date: Tue, 9 Dec 2025 15:15:13 +0800
From: Can Peng <pengcan@...inos.cn>
To: joro@...tes.org,
will@...nel.org,
robin.murphy@....com
Cc: iommu@...ts.linux.dev,
linux-kernel@...r.kernel.org,
Can Peng <pengcan@...inos.cn>
Subject: [PATCH] iommu: simplify list initialization in iommu_create_device_direct_mappings()
Use LIST_HEAD() to declare and initialize the 'mappings' list head in
iommu_create_device_direct_mappings() instead of separate declaration and
INIT_LIST_HEAD(). This simplifies the code by combining declaration and
initialization into a single idiomatic form, improving readability without
changing functionality.
Signed-off-by: Can Peng <pengcan@...inos.cn>
---
drivers/iommu/iommu.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c
index 2ca990dfbb88..77d723f43546 100644
--- a/drivers/iommu/iommu.c
+++ b/drivers/iommu/iommu.c
@@ -1173,12 +1173,11 @@ static int iommu_create_device_direct_mappings(struct iommu_domain *domain,
struct device *dev)
{
struct iommu_resv_region *entry;
- struct list_head mappings;
+ LIST_HEAD(mappings);
unsigned long pg_size;
int ret = 0;
pg_size = domain->pgsize_bitmap ? 1UL << __ffs(domain->pgsize_bitmap) : 0;
- INIT_LIST_HEAD(&mappings);
if (WARN_ON_ONCE(iommu_is_dma_domain(domain) && !pg_size))
return -EINVAL;
--
2.25.1
Powered by blists - more mailing lists