summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCan Peng <pengcan@kylinos.cn>2025-12-09 10:15:13 +0300
committerJoerg Roedel <joerg.roedel@amd.com>2026-01-10 12:58:54 +0300
commit16e3423fc755cf9ddcceefaf70869311046928e2 (patch)
tree4028dab04efb7a05e142364536af901b9cba6f9b
parenta8258ffed2efdf533bdc756141eeb7bc5301ad4f (diff)
downloadlinux-16e3423fc755cf9ddcceefaf70869311046928e2.tar.xz
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@kylinos.cn> Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
-rw-r--r--drivers/iommu/iommu.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c
index 585b13bcc8cf..4926a43118e6 100644
--- a/drivers/iommu/iommu.c
+++ b/drivers/iommu/iommu.c
@@ -1180,12 +1180,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;