drivers/iommu/iommu.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
Replace the manual declaration and INIT_LIST_HEAD() call with the
LIST_HEAD() macro when initializing group_resv_regions in
iommu_group_show_resv_regions(). This simplifies the code and makes
the list initialization more concise.
No functional change intended.
Signed-off-by: Can Peng <pengcan@kylinos.cn>
---
### Changes since v2:
- Rebased on top of iommu/next as requested by Vasant Hegde.
- Adjusted commit message to be shorter and clearer, following Markus Elfring's
suggestion.
- Retained the LIST_HEAD() cleanup pattern consistently across the file.
### Notes on v2 discussion:
- V2 was reviewed positively:
- Reviewed-by: Vasant Hegde <vasant.hegde@amd.com>
Link: https://lore.kernel.org/all/4526ca31-71a4-4b3f-b378-32546eb8133d@amd.com/
- Markus Elfring suggested a shorter summary phrase and pointed out that
Jörg Rödel had already applied the patch ("Applied, thanks." on 2026-01-10).
Link: https://lore.kernel.org/lkml/stpavkxy3sbevk7zmt4kxyecqy5gc6phubvcfutbtnuk7vphlh@a7aimtvk423i/
Thanks everyone for the review and suggestions.
Best regards,
Can Peng
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 4926a43118e6..2f31527b3c62 100644
--- a/drivers/iommu/iommu.c
+++ b/drivers/iommu/iommu.c
@@ -957,10 +957,9 @@ static ssize_t iommu_group_show_resv_regions(struct iommu_group *group,
char *buf)
{
struct iommu_resv_region *region, *next;
- struct list_head group_resv_regions;
+ LIST_HEAD(group_resv_regions);
int offset = 0;
- INIT_LIST_HEAD(&group_resv_regions);
iommu_get_group_resv_regions(group, &group_resv_regions);
list_for_each_entry_safe(region, next, &group_resv_regions, list) {
--
2.25.1
> Replace the manual declaration and INIT_LIST_HEAD() call with the
> LIST_HEAD() macro when initializing group_resv_regions in
> iommu_group_show_resv_regions(). This simplifies the code and makes
Simplify? make?
> the list initialization more concise.
…
> ---
> ### Changes since v2:
…
> - Retained the LIST_HEAD() cleanup pattern consistently across the file.
Can you recognise further adjustment opportunities from the presented small script
for the semantic patch language?
https://lore.kernel.org/cocci/34ed442d-6ebd-4907-a77c-2c08db799411@web.de/
https://sympa.inria.fr/sympa/arc/cocci/2026-01/msg00002.html
https://lkml.org/lkml/2026/1/12/932
Example for another update candidate:
iommu_get_group_resv_regions()
https://elixir.bootlin.com/linux/v6.19-rc5/source/drivers/iommu/iommu.c#L920-L946
Regards,
Markus
© 2016 - 2026 Red Hat, Inc.