From 6d7bcc7883217d21537834917bbc9673e135d515 Mon Sep 17 00:00:00 2001
From: Rongjun Chen <rongjun.chen@amlogic.com>
Date: Thu, 31 Aug 2017 13:49:22 +0800
Subject: [PATCH] wifi: fix wl_event_hander Duplicate creation issue [1/1]

PD#150156

Change-Id: I3c0820c6141e3a8a70df7e03af1b2b68925adbb7
wifi: fix wl_event_hander Duplicate creation issue
---
 bcmdhd-usb.1.363.110.17.x/wl_cfg80211.c | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/bcmdhd-usb.1.363.110.17.x/wl_cfg80211.c b/bcmdhd-usb.1.363.110.17.x/wl_cfg80211.c
index 0c7b24f..882e5d6 100644
--- a/bcmdhd-usb.1.363.110.17.x/wl_cfg80211.c
+++ b/bcmdhd-usb.1.363.110.17.x/wl_cfg80211.c
@@ -12053,12 +12053,13 @@ static void wl_deinit_priv_mem(struct bcm_cfg80211 *cfg)
 static s32 wl_create_event_handler(struct bcm_cfg80211 *cfg)
 {
 	int ret = 0;
-	WL_DBG(("Enter \n"));
 
 	/* Do not use DHD in cfg driver */
-	cfg->event_tsk.thr_pid = -1;
-
-	PROC_START(wl_event_handler, cfg, &cfg->event_tsk, 0, "wl_event_handler");
+	if (!cfg->event_tsk.thr_pid) {
+		WL_DBG(("Enter \n"));
+		cfg->event_tsk.thr_pid = -1;
+		PROC_START(wl_event_handler, cfg, &cfg->event_tsk, 0, "wl_event_handler");
+	}
 	if (cfg->event_tsk.thr_pid < 0)
 		ret = -ENOMEM;
 	return ret;
@@ -12066,8 +12067,10 @@ static s32 wl_create_event_handler(struct bcm_cfg80211 *cfg)
 
 static void wl_destroy_event_handler(struct bcm_cfg80211 *cfg)
 {
-	if (cfg->event_tsk.thr_pid >= 0)
+	if (cfg->event_tsk.thr_pid >= 0) {
+		WL_DBG(("Enter \n"));
 		PROC_STOP(&cfg->event_tsk);
+	}
 }
 
 void wl_terminate_event_handler(void)
-- 
2.20.1