mac80211 requires that drv_sched_scan_stop will always succeed. We have a few possible errors such as OOM, failure to ELP wakeup, fail in the FW command. Instead of no-op , trigger a recovery which would mark sched scan as stopped and clear up any bad FW state. Signed-off-by: Eyal Shapira <eyal@xxxxxxxxxx> --- drivers/net/wireless/wl12xx/main.c | 4 +++- drivers/net/wireless/wl12xx/scan.c | 14 +++++++++----- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/drivers/net/wireless/wl12xx/main.c b/drivers/net/wireless/wl12xx/main.c index d5f55a1..0d3de3e 100644 --- a/drivers/net/wireless/wl12xx/main.c +++ b/drivers/net/wireless/wl12xx/main.c @@ -3137,8 +3137,10 @@ static void wl1271_op_sched_scan_stop(struct ieee80211_hw *hw, mutex_lock(&wl->mutex); ret = wl1271_ps_elp_wakeup(wl); - if (ret < 0) + if (ret < 0) { + wl12xx_queue_recovery_work(wl); goto out; + } wl1271_scan_sched_scan_stop(wl); diff --git a/drivers/net/wireless/wl12xx/scan.c b/drivers/net/wireless/wl12xx/scan.c index e24111e..108bed4 100644 --- a/drivers/net/wireless/wl12xx/scan.c +++ b/drivers/net/wireless/wl12xx/scan.c @@ -739,22 +739,26 @@ void wl1271_scan_sched_scan_stop(struct wl1271 *wl) wl1271_debug(DEBUG_CMD, "cmd periodic scan stop"); - /* FIXME: what to do if alloc'ing to stop fails? */ stop = kzalloc(sizeof(*stop), GFP_KERNEL); if (!stop) { wl1271_error("failed to alloc memory to send sched scan stop"); - return; + goto recovery; } stop->tag = WL1271_SCAN_DEFAULT_TAG; ret = wl1271_cmd_send(wl, CMD_STOP_PERIODIC_SCAN, stop, sizeof(*stop), 0); + + kfree(stop); + if (ret < 0) { wl1271_error("failed to send sched scan stop command"); - goto out_free; + goto recovery; } -out_free: - kfree(stop); + return; + +recovery: + wl12xx_queue_recovery_work(wl); } -- 1.7.4.1 -- To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html