Skip to contentSkip to conversation

cpumask: use for_each_online_cpu() in drivers/infiniband/hw/ehca/ehca_irq.c

PATCH In review Rusty Russell 2 participants 2 messages Nov 21, 2008 – Nov 25, 2008 InfiniBand

lore
Share & tools
lore
#0 lore raw

PATCH 1/3 cpumask: use for_each_online_cpu() in drivers/infiniband/hw/ehca/ehca_irq.c

Impact: cleanup

In future, accessing cpu numbers beyond nr_cpu_ids (the runtime limit) will be undefined. We can avoid future problems by using for_each_online_cpu() here.

Cc Hoang-Nam Nguyen <[email protected]>
Cc Christoph Raisch <[email protected]>
---
 drivers/infiniband/hw/ehca/ehca_irq.c |    7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
drivers/infiniband/hw/ehca/ehca_irq.c +3 -4
diff -r 38b459d1e9c7 drivers/infiniband/hw/ehca/ehca_irq.c
@@ -922,10 +922,9 @@ void ehca_destroy_comp_pool(void)
 
 	unregister_hotcpu_notifier(&comp_pool_callback_nb);
 
-	for (i = 0; i < NR_CPUS; i++) {
-		if (cpu_online(i))
-			destroy_comp_task(pool, i);
-	}
+	for_each_online_cpu(i)
+		destroy_comp_task(pool, i);
+
 	free_percpu(pool->cpu_comp_tasks);
 	kfree(pool);
 }