wlan: Fix for kernel crash in set channel function

NL80211 layer is passing NULL device in set channel request if the
device type is station. This is happening when we switch from SAP mode
to STA continuously.

Change-Id: If74b88b5452ade6b20cc69a29fd07fa4130316ae
CR-Fixed: 414153
diff --git a/CORE/HDD/src/wlan_hdd_cfg80211.c b/CORE/HDD/src/wlan_hdd_cfg80211.c
index 44d72bc..70e6fe9 100644
--- a/CORE/HDD/src/wlan_hdd_cfg80211.c
+++ b/CORE/HDD/src/wlan_hdd_cfg80211.c
@@ -3233,10 +3233,18 @@
 {
     v_U32_t num_ch = 0;
     u32 channel = 0;
-    hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( dev ); 
+    hdd_adapter_t *pAdapter = NULL; 
     int freq = chan->center_freq; /* freq is in MHZ */ 
  
     ENTER();
+
+    if( NULL == dev )
+    {
+        hddLog(VOS_TRACE_LEVEL_ERROR, 
+                "%s: Called with dev = NULL.\n", __func__);
+        return -ENODEV;
+    }
+    pAdapter = WLAN_HDD_GET_PRIV_PTR( dev ); 
     
     hddLog(VOS_TRACE_LEVEL_INFO, 
                 "%s: device_mode = %d  freq = %d \n",__func__,