From: Rongjun Chen <rongjun.chen@amlogic.com>
Date: Thu, 31 Aug 2017 05:49:22 +0000 (+0800)
Subject: wifi: fix wl_event_hander Duplicate creation issue [1/1]
X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=6d7bcc7883217d21537834917bbc9673e135d515;p=GitHub%2FLineageOS%2FG12%2Fandroid_hardware_amlogic_kernel-modules_dhd-driver.git

wifi: fix wl_event_hander Duplicate creation issue [1/1]

PD#150156

Change-Id: I3c0820c6141e3a8a70df7e03af1b2b68925adbb7
wifi: fix wl_event_hander Duplicate creation issue
---

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)