diff mbox

wlcore: unlock on error in wl1271_op_suspend()

Message ID 20150115114340.GC17976@mwanda (mailing list archive)
State Accepted
Delegated to: Kalle Valo
Headers show

Commit Message

Dan Carpenter Jan. 15, 2015, 11:43 a.m. UTC
We recently introduced a new error path which needs an unlock.

Fixes: 6d5a748d4836 ('wlcore: add ability to reduce FW interrupts during suspend')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
Static checker fix.  It's possible that wl1271_ps_elp_wakeup() unlocks
on error but I didn't see it, and that would be an ugly API.

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Eliad Peller Jan. 15, 2015, 12:34 p.m. UTC | #1
On Thu, Jan 15, 2015 at 1:43 PM, Dan Carpenter <dan.carpenter@oracle.com> wrote:
> We recently introduced a new error path which needs an unlock.
>
> Fixes: 6d5a748d4836 ('wlcore: add ability to reduce FW interrupts during suspend')
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
> Static checker fix.  It's possible that wl1271_ps_elp_wakeup() unlocks
> on error but I didn't see it, and that would be an ugly API.
>
> diff --git a/drivers/net/wireless/ti/wlcore/main.c b/drivers/net/wireless/ti/wlcore/main.c
> index e90fb78..02f0e86 100644
> --- a/drivers/net/wireless/ti/wlcore/main.c
> +++ b/drivers/net/wireless/ti/wlcore/main.c
> @@ -1785,8 +1785,10 @@ static int wl1271_op_suspend(struct ieee80211_hw *hw,
>         mutex_lock(&wl->mutex);
>
>         ret = wl1271_ps_elp_wakeup(wl);
> -       if (ret < 0)
> +       if (ret < 0) {
> +               mutex_unlock(&wl->mutex);
>                 return ret;
> +       }
>
The patch is correct, thanks.
If you'll take a look at other functions in the file, you'll usually
see "goto out_unlock" (or something similar) in this case.

Eliad.
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Kalle Valo Jan. 23, 2015, 5:38 p.m. UTC | #2
> We recently introduced a new error path which needs an unlock.
> 
> Fixes: 6d5a748d4836 ('wlcore: add ability to reduce FW interrupts during suspend')
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Thanks, applied to wireless-drivers-next.git.

Kalle Valo
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/net/wireless/ti/wlcore/main.c b/drivers/net/wireless/ti/wlcore/main.c
index e90fb78..02f0e86 100644
--- a/drivers/net/wireless/ti/wlcore/main.c
+++ b/drivers/net/wireless/ti/wlcore/main.c
@@ -1785,8 +1785,10 @@  static int wl1271_op_suspend(struct ieee80211_hw *hw,
 	mutex_lock(&wl->mutex);
 
 	ret = wl1271_ps_elp_wakeup(wl);
-	if (ret < 0)
+	if (ret < 0) {
+		mutex_unlock(&wl->mutex);
 		return ret;
+	}
 
 	wl->wow_enabled = true;
 	wl12xx_for_each_wlvif(wl, wlvif) {