net: wireless: bcmdhd: Fix proper scan command even if request is NULL
Dmitry Shmidt [Wed, 14 Dec 2011 01:39:48 +0000 (17:39 -0800)]
Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>

drivers/net/wireless/bcmdhd/wl_cfg80211.c

index 16de422..0720022 100644 (file)
@@ -1130,8 +1130,8 @@ wl_cfg80211_notify_ifchange(void)
 
 static void wl_scan_prep(struct wl_scan_params *params, struct cfg80211_scan_request *request)
 {
-       u32 n_ssids = request->n_ssids;
-       u32 n_channels = request->n_channels;
+       u32 n_ssids;
+       u32 n_channels;
        u16 channel;
        chanspec_t chanspec;
        s32 i, offset;
@@ -1160,6 +1160,12 @@ static void wl_scan_prep(struct wl_scan_params *params, struct cfg80211_scan_req
        params->passive_time = htod32(params->passive_time);
        params->home_time = htod32(params->home_time);
 
+       if (!request)
+               return;
+
+       n_ssids = request->n_ssids;
+       n_channels = request->n_channels;
+
        /* Copy channel array if applicable */
        WL_SCAN(("### List of channelspecs to scan ###\n"));
        if (n_channels > 0) {
@@ -1248,8 +1254,7 @@ wl_run_iscan(struct wl_iscan_ctrl *iscan, struct cfg80211_scan_request *request,
                return -ENOMEM;
        }
 
-       if (request != NULL)
-               wl_scan_prep(&params->params, request);
+       wl_scan_prep(&params->params, request);
 
        params->version = htod32(ISCAN_REQ_VERSION);
        params->action = htod16(action);
@@ -1340,8 +1345,7 @@ wl_run_escan(struct wl_priv *wl, struct net_device *ndev,
                        goto exit;
                }
 
-               if (request != NULL)
-                       wl_scan_prep(&params->params, request);
+               wl_scan_prep(&params->params, request);
                params->version = htod32(ESCAN_REQ_VERSION);
                params->action =  htod16(action);
                params->sync_id = htod16(0x1234);