From patchwork Tue Mar 12 13:44:23 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luciano Coelho X-Patchwork-Id: 2256491 Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 479984006E for ; Tue, 12 Mar 2013 13:45:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755477Ab3CLNpt (ORCPT ); Tue, 12 Mar 2013 09:45:49 -0400 Received: from devils.ext.ti.com ([198.47.26.153]:50605 "EHLO devils.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755468Ab3CLNpt (ORCPT ); Tue, 12 Mar 2013 09:45:49 -0400 Received: from dlelxv30.itg.ti.com ([172.17.2.17]) by devils.ext.ti.com (8.13.7/8.13.7) with ESMTP id r2CDjm2I003608; Tue, 12 Mar 2013 08:45:48 -0500 Received: from DFLE73.ent.ti.com (dfle73.ent.ti.com [128.247.5.110]) by dlelxv30.itg.ti.com (8.13.8/8.13.8) with ESMTP id r2CDjm4B017564; Tue, 12 Mar 2013 08:45:48 -0500 Received: from dlelxv22.itg.ti.com (172.17.1.197) by dfle73.ent.ti.com (128.247.5.110) with Microsoft SMTP Server id 14.1.323.3; Tue, 12 Mar 2013 08:45:48 -0500 Received: from cumari.coelho.fi (h79-11.vpn.ti.com [172.24.79.11]) by dlelxv22.itg.ti.com (8.13.8/8.13.8) with ESMTP id r2CDjTqJ028272; Tue, 12 Mar 2013 08:45:47 -0500 From: Luciano Coelho To: CC: , Arik Nemtsov Subject: [PATCH 12/13] wlcore: correctly check state before regdomain conf Date: Tue, 12 Mar 2013 15:44:23 +0200 Message-ID: <1363095864-24422-13-git-send-email-coelho@ti.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1363095864-24422-1-git-send-email-coelho@ti.com> References: <1363095864-24422-1-git-send-email-coelho@ti.com> MIME-Version: 1.0 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org From: Arik Nemtsov 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 Signed-off-by: Luciano Coelho --- drivers/net/wireless/ti/wlcore/main.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/ti/wlcore/main.c b/drivers/net/wireless/ti/wlcore/main.c index 43865d1..248daa9 100644 --- a/drivers/net/wireless/ti/wlcore/main.c +++ b/drivers/net/wireless/ti/wlcore/main.c @@ -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, @@ -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;