提交 a82268b3 编写于 作者: I Insu Yun 提交者: Doug Ledford

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: NInsu Yun <wuninsu@gmail.com>
Reviewed-by: NLeon Romanovsky <leon@leon.nu>
Signed-off-by: NDoug Ledford <dledford@redhat.com>
上级 bfec53c6
......@@ -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;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册