Skip to content

Commit 16e3423

Browse files
Can Pengjoergroedel
authored andcommitted
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>
1 parent a8258ff commit 16e3423

1 file changed

Lines changed: 1 addition & 2 deletions

File tree

drivers/iommu/iommu.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1180,12 +1180,11 @@ static int iommu_create_device_direct_mappings(struct iommu_domain *domain,
11801180
struct device *dev)
11811181
{
11821182
struct iommu_resv_region *entry;
1183-
struct list_head mappings;
1183+
LIST_HEAD(mappings);
11841184
unsigned long pg_size;
11851185
int ret = 0;
11861186

11871187
pg_size = domain->pgsize_bitmap ? 1UL << __ffs(domain->pgsize_bitmap) : 0;
1188-
INIT_LIST_HEAD(&mappings);
11891188

11901189
if (WARN_ON_ONCE(iommu_is_dma_domain(domain) && !pg_size))
11911190
return -EINVAL;

0 commit comments

Comments
 (0)