From ddcdcbad32371a26cd00f794d95e397121806e8f Mon Sep 17 00:00:00 2001 From: Weiguang Ruan Date: Mon, 26 Sep 2016 10:49:37 +0800 Subject: [PATCH] PD#132119: wifi: fix PROC_START out of mem error if p_task created fail due to out of memory, p_task->pid would still to be used, fix this error. verify pass with p212 board Change-Id: I563a6aa2342048f086f81da0c226d9d32a4828da --- bcmdhd_1_201_59_x/include/linuxver.h | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/bcmdhd_1_201_59_x/include/linuxver.h b/bcmdhd_1_201_59_x/include/linuxver.h index 7e13746..c39e3df 100644 --- a/bcmdhd_1_201_59_x/include/linuxver.h +++ b/bcmdhd_1_201_59_x/include/linuxver.h @@ -586,10 +586,16 @@ static inline bool binary_sema_up(tsk_ctl_t *tsk) (tsk_ctl)->proc_name = name; \ (tsk_ctl)->terminated = FALSE; \ (tsk_ctl)->p_task = kthread_run(thread_func, tsk_ctl, (char*)name); \ - (tsk_ctl)->thr_pid = (tsk_ctl)->p_task->pid; \ + if (!IS_ERR((tsk_ctl)->p_task)) { \ + (tsk_ctl)->thr_pid = (tsk_ctl)->p_task->pid; \ + DBG_THR(("%s(): thread:%s:%lx started\n", __FUNCTION__, \ + (tsk_ctl)->proc_name, (tsk_ctl)->thr_pid)); \ + } else {\ + (tsk_ctl)->thr_pid = -1; \ + DBG_THR(("%s(): thread:%s:%lx create fail\n", __FUNCTION__, \ + (tsk_ctl)->proc_name, (tsk_ctl)->thr_pid)); \ + }\ spin_lock_init(&((tsk_ctl)->spinlock)); \ - DBG_THR(("%s(): thread:%s:%lx started\n", __FUNCTION__, \ - (tsk_ctl)->proc_name, (tsk_ctl)->thr_pid)); \ } #define PROC_STOP(tsk_ctl) \ -- 2.20.1