[PATCH 6/6] irqchip/gic-v3-its: some minor cleanups

Kemeng Shi shikemeng at huaweicloud.com
Sun Jun 14 20:29:10 PDT 2026


1. Remove unneeded NULL check in itt_alloc_pool() as addr will always be
NULL when we reach here.
2. Correct indentation in cpumask_pick_least_loaded()
3. Remove unneeded updation of range node when it is to be deleted in
alloc_lpi_range().
4. Remove unneeded assignment to baser->psz which is already used
as input inits_setup_baser()

Signed-off-by: Kemeng Shi <shikemeng at huaweicloud.com>
---
 drivers/irqchip/irq-gic-v3-its.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/irqchip/irq-gic-v3-its.c b/drivers/irqchip/irq-gic-v3-its.c
index fc32a1709f76..ef505575ba86 100644
--- a/drivers/irqchip/irq-gic-v3-its.c
+++ b/drivers/irqchip/irq-gic-v3-its.c
@@ -273,7 +273,7 @@ static void *itt_alloc_pool(int node, int size)
 			break;
 
 		gen_pool_add(itt_pool, (unsigned long)page_address(page), PAGE_SIZE, node);
-	} while (!addr);
+	} while (true);
 
 	return (void *)addr;
 }
@@ -1681,7 +1681,7 @@ static unsigned int cpumask_pick_least_loaded(struct irq_data *d,
 		int this_count = its_read_lpi_count(d, tmp);
 		if (this_count < count) {
 			cpu = tmp;
-		        count = this_count;
+			count = this_count;
 		}
 	}
 
@@ -2127,12 +2127,13 @@ static int alloc_lpi_range(u32 nr_lpis, u32 *base)
 	list_for_each_entry_safe(range, tmp, &lpi_range_list, entry) {
 		if (range->span >= nr_lpis) {
 			*base = range->base_id;
-			range->base_id += nr_lpis;
-			range->span -= nr_lpis;
 
-			if (range->span == 0) {
+			if (range->span == nr_lpis) {
 				list_del(&range->entry);
 				kfree(range);
+			} else {
+				range->base_id += nr_lpis;
+				range->span -= nr_lpis;
 			}
 
 			err = 0;
@@ -2472,7 +2473,6 @@ static int its_setup_baser(struct its_node *its, struct its_baser *baser,
 
 	baser->order = order;
 	baser->base = base;
-	baser->psz = psz;
 	tmp = indirect ? GITS_LVL1_ENTRY_SIZE : esz;
 
 	pr_info("ITS@%pa: allocated %d %s @%llx (%s, esz %d, psz %dK, shr %d)\n",
-- 
2.36.1




More information about the linux-arm-kernel mailing list