Skip to content

Commit

Permalink
wlcore: correctly check state before regdomain conf
Browse files Browse the repository at this point in the history
The wlcore state was checked without the mutex being taken. This leads
to WARN_ONs sometimes if a notification arrives when the driver
is on, but the mutex is only taken after it is off. This usually
happens if stopping the driver while connected to a network.

Signed-off-by: Arik Nemtsov <arik@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
  • Loading branch information
Arik Nemtsov authored and Luciano Coelho committed Mar 25, 2013
1 parent 0e752df commit 75592be
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions drivers/net/wireless/ti/wlcore/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,7 @@ static void wl1271_reg_notify(struct wiphy *wiphy,

}

if (likely(wl->state == WLCORE_STATE_ON))
wlcore_regdomain_config(wl);
wlcore_regdomain_config(wl);
}

static int wl1271_set_rx_streaming(struct wl1271 *wl, struct wl12xx_vif *wlvif,
Expand Down Expand Up @@ -3364,6 +3363,10 @@ void wlcore_regdomain_config(struct wl1271 *wl)
return;

mutex_lock(&wl->mutex);

if (unlikely(wl->state != WLCORE_STATE_ON))
goto out;

ret = wl1271_ps_elp_wakeup(wl);
if (ret < 0)
goto out;
Expand Down

0 comments on commit 75592be

Please sign in to comment.