Skip to content

Commit

Permalink
nes: handling failed allocation when creating workqueue
Browse files Browse the repository at this point in the history
Since create_singlethread_workqueue uses kzalloc internally,
it can fail when the system is under memory pressure, so need
to handle it.

Signed-off-by: Insu Yun <wuninsu@gmail.com>
Reviewed-by: Leon Romanovsky <leon@leon.nu>
Signed-off-by: Doug Ledford <dledford@redhat.com>
  • Loading branch information
Insu Yun authored and Doug Ledford committed Feb 29, 2016
1 parent bfec53c commit a82268b
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions drivers/infiniband/hw/nes/nes_cm.c
Original file line number Diff line number Diff line change
Expand Up @@ -2856,12 +2856,22 @@ static struct nes_cm_core *nes_cm_alloc_core(void)

nes_debug(NES_DBG_CM, "Enable QUEUE EVENTS\n");
cm_core->event_wq = create_singlethread_workqueue("nesewq");
if (!cm_core->event_wq)
goto out_free_cmcore;
cm_core->post_event = nes_cm_post_event;
nes_debug(NES_DBG_CM, "Enable QUEUE DISCONNECTS\n");
cm_core->disconn_wq = create_singlethread_workqueue("nesdwq");
if (!cm_core->disconn_wq)
goto out_free_wq;

print_core(cm_core);
return cm_core;

out_free_wq:
destroy_workqueue(cm_core->event_wq);
out_free_cmcore:
kfree(cm_core);
return NULL;
}


Expand Down

0 comments on commit a82268b

Please sign in to comment.