public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ehca: fix kthread_create() error check
@ 2006-12-19  8:42 Akinobu Mita
  2006-12-19  9:32 ` Hoang-Nam Nguyen
  2006-12-21 21:22 ` Heiko Carstens
  0 siblings, 2 replies; 11+ messages in thread
From: Akinobu Mita @ 2006-12-19  8:42 UTC (permalink / raw)
  To: linux-kernel; +Cc: Hoang-Nam Nguyen, Christoph Raisch

The return value of kthread_create() should be checked by
IS_ERR(). create_comp_task() returns the return value from
kthread_create().

Cc: Hoang-Nam Nguyen <hnguyen@de.ibm.com>
Cc: Christoph Raisch <raisch@de.ibm.com>
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>

---
 drivers/infiniband/hw/ehca/ehca_irq.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Index: 2.6-mm/drivers/infiniband/hw/ehca/ehca_irq.c
===================================================================
--- 2.6-mm.orig/drivers/infiniband/hw/ehca/ehca_irq.c
+++ 2.6-mm/drivers/infiniband/hw/ehca/ehca_irq.c
@@ -670,11 +670,13 @@ static int comp_pool_callback(struct not
 {
 	unsigned int cpu = (unsigned long)hcpu;
 	struct ehca_cpu_comp_task *cct;
+	struct task_struct *task;
 
 	switch (action) {
 	case CPU_UP_PREPARE:
 		ehca_gen_dbg("CPU: %x (CPU_PREPARE)", cpu);
-		if(!create_comp_task(pool, cpu)) {
+		task = create_comp_task(pool, cpu);
+		if (IS_ERR(task)) {
 			ehca_gen_err("Can't create comp_task for cpu: %x", cpu);
 			return NOTIFY_BAD;
 		}
@@ -730,7 +732,7 @@ int ehca_create_comp_pool(void)
 
 	for_each_online_cpu(cpu) {
 		task = create_comp_task(pool, cpu);
-		if (task) {
+		if (!IS_ERR(task)) {
 			kthread_bind(task, cpu);
 			wake_up_process(task);
 		}

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2006-12-25  9:58 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-12-19  8:42 [PATCH] ehca: fix kthread_create() error check Akinobu Mita
2006-12-19  9:32 ` Hoang-Nam Nguyen
2006-12-21 21:22 ` Heiko Carstens
2006-12-25  8:12   ` [PATCH -mm] ehca: avoid crash on kthread_create() failure Akinobu Mita
2006-12-25  8:30     ` Akinobu Mita
2006-12-25  8:55       ` Muli Ben-Yehuda
2006-12-25  9:35         ` Akinobu Mita
2006-12-25  9:41           ` Muli Ben-Yehuda
2006-12-25  9:58             ` Akinobu Mita
2006-12-25  8:13   ` [PATCH -mm] return error on create_comp_task() failure Akinobu Mita
2006-12-25  8:14   ` [PATCH -mm] ehca: fix memleak on module unloading Akinobu Mita

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox