The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Rusty Russell <rusty@rustcorp.com.au>
To: "Hoang-Nam Nguyen" <hnguyen@de.ibm.com>
Cc: linux-kernel@vger.kernel.org, Christoph Raisch <raisch@de.ibm.com>
Cc: Christoph Raisch <raisch@de.ibm.com>
Subject: [PATCH 1/3] cpumask: use for_each_online_cpu() in drivers/infiniband/hw/ehca/ehca_irq.c
Date: Sat, 22 Nov 2008 00:20:07 +1030	[thread overview]
Message-ID: <200811220020.07407.rusty@rustcorp.com.au> (raw)

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.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Cc: Hoang-Nam Nguyen <hnguyen@de.ibm.com>
Cc: Christoph Raisch <raisch@de.ibm.com>
---
 drivers/infiniband/hw/ehca/ehca_irq.c |    7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff -r 38b459d1e9c7 drivers/infiniband/hw/ehca/ehca_irq.c
--- a/drivers/infiniband/hw/ehca/ehca_irq.c	Fri Nov 07 22:33:08 2008 +1100
+++ b/drivers/infiniband/hw/ehca/ehca_irq.c	Fri Nov 07 22:48:13 2008 +1100
@@ -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);
 }



             reply	other threads:[~2008-11-21 13:50 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-11-21 13:50 Rusty Russell [this message]
2008-11-25 12:59 ` [PATCH 1/3] cpumask: use for_each_online_cpu() in drivers/infiniband/hw/ehca/ehca_irq.c Hoang-Nam Nguyen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200811220020.07407.rusty@rustcorp.com.au \
    --to=rusty@rustcorp.com.au \
    --cc=hnguyen@de.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=raisch@de.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox