staging: wilc1000: assign scan result callback before starting the scan
authorAdham Abozaeid <adham.abozaeid@microchip.com>
Wed, 27 Mar 2019 20:28:34 +0000 (20:28 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 29 Mar 2019 16:10:18 +0000 (17:10 +0100)
When scan is triggered, sometimes scan results are received before the scan
result callback is assigned, causing the recieved results to be ignored.

Signed-off-by: Adham Abozaeid <adham.abozaeid@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/wilc1000/host_interface.c

index 91ea16a6ae2e986066f919f3fdbac333babe3c11..e1a35bb426f9d89a5db9f89e82d437dd99c018bb 100644 (file)
@@ -313,6 +313,9 @@ int wilc_scan(struct wilc_vif *vif, u8 scan_source, u8 scan_type,
        wid_list[index].val = (s8 *)&scan_source;
        index++;
 
+       hif_drv->usr_scan_req.scan_result = scan_result_fn;
+       hif_drv->usr_scan_req.arg = user_arg;
+
        result = wilc_send_config_pkt(vif, WILC_SET_CFG, wid_list,
                                      index,
                                      wilc_get_vif_idx(vif));
@@ -321,8 +324,6 @@ int wilc_scan(struct wilc_vif *vif, u8 scan_source, u8 scan_type,
                goto error;
        }
 
-       hif_drv->usr_scan_req.scan_result = scan_result_fn;
-       hif_drv->usr_scan_req.arg = user_arg;
        hif_drv->scan_timer_vif = vif;
        mod_timer(&hif_drv->scan_timer,
                  jiffies + msecs_to_jiffies(WILC_HIF_SCAN_TIMEOUT_MS));