diff options
| author | Insu Yun <wuninsu@gmail.com> | 2016-02-17 13:06:33 -0500 |
|---|---|---|
| committer | Doug Ledford <dledford@redhat.com> | 2016-02-29 17:11:57 -0500 |
| commit | a82268b30a8b4b920d0bad24472cbb000c8e734a (patch) | |
| tree | 063c147555cf98e4b6bf0c6604d5fa16ad7a6f1b /drivers/infiniband/hw/nes | |
| parent | bfec53c6c88aa2b18a5015ca3e0137d4e0dec95a (diff) | |
nes: handling failed allocation when creating workqueue
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>
Diffstat (limited to 'drivers/infiniband/hw/nes')
| -rw-r--r-- | drivers/infiniband/hw/nes/nes_cm.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/drivers/infiniband/hw/nes/nes_cm.c b/drivers/infiniband/hw/nes/nes_cm.c index cb9f0f27308d..e3fc2a14904c 100644 --- a/drivers/infiniband/hw/nes/nes_cm.c +++ b/drivers/infiniband/hw/nes/nes_cm.c | |||
| @@ -2856,12 +2856,22 @@ static struct nes_cm_core *nes_cm_alloc_core(void) | |||
| 2856 | 2856 | ||
| 2857 | nes_debug(NES_DBG_CM, "Enable QUEUE EVENTS\n"); | 2857 | nes_debug(NES_DBG_CM, "Enable QUEUE EVENTS\n"); |
| 2858 | cm_core->event_wq = create_singlethread_workqueue("nesewq"); | 2858 | cm_core->event_wq = create_singlethread_workqueue("nesewq"); |
| 2859 | if (!cm_core->event_wq) | ||
| 2860 | goto out_free_cmcore; | ||
| 2859 | cm_core->post_event = nes_cm_post_event; | 2861 | cm_core->post_event = nes_cm_post_event; |
| 2860 | nes_debug(NES_DBG_CM, "Enable QUEUE DISCONNECTS\n"); | 2862 | nes_debug(NES_DBG_CM, "Enable QUEUE DISCONNECTS\n"); |
| 2861 | cm_core->disconn_wq = create_singlethread_workqueue("nesdwq"); | 2863 | cm_core->disconn_wq = create_singlethread_workqueue("nesdwq"); |
| 2864 | if (!cm_core->disconn_wq) | ||
| 2865 | goto out_free_wq; | ||
| 2862 | 2866 | ||
| 2863 | print_core(cm_core); | 2867 | print_core(cm_core); |
| 2864 | return cm_core; | 2868 | return cm_core; |
| 2869 | |||
| 2870 | out_free_wq: | ||
| 2871 | destroy_workqueue(cm_core->event_wq); | ||
| 2872 | out_free_cmcore: | ||
| 2873 | kfree(cm_core); | ||
| 2874 | return NULL; | ||
| 2865 | } | 2875 | } |
| 2866 | 2876 | ||
| 2867 | 2877 | ||
