The sched_scan_(stop|start) ops fails to check for WL1271_STATE_OFF.
This can lead to a race where the driver tries to access the HW
while it's off.
Fix this by checking for WL1271_STATE_OFF before accessing the HW.
Signed-off-by: Pontus Fuchs <pontus.fuchs@gmail.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
 
        mutex_lock(&wl->mutex);
 
+       if (wl->state == WL1271_STATE_OFF) {
+               ret = -EAGAIN;
+               goto out;
+       }
+
        ret = wl1271_ps_elp_wakeup(wl);
        if (ret < 0)
                goto out;
 
        mutex_lock(&wl->mutex);
 
+       if (wl->state == WL1271_STATE_OFF)
+               goto out;
+
        ret = wl1271_ps_elp_wakeup(wl);
        if (ret < 0)
                goto out;