Skip to contentSkip to conversation

wlcore: unlock on error in wl1271_op_suspend()

PATCH Applied Dan Carpenter 3 participants 3 messages Jan 15, 2015 – Jan 23, 2015

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 wlcore: unlock on error in wl1271_op_suspend()

We recently introduced a new error path which needs an unlock.

Fixes 6d5a748d4836 ('wlcore: add ability to reduce FW interrupts during suspend')

---
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.

drivers/net/wireless/ti/wlcore/main.c +3 -1
index e90fb78..02f0e86 100644
@@ -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) {
#1 lore raw
Quoted 13 lines · Dan Carpenter

We recently introduced a new error path which needs an unlock.

Fixes 6d5a748d4836 ('wlcore: add ability to reduce FW interrupts during suspend')

---
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.

drivers/net/wireless/ti/wlcore/main.c +0 -0
index e90fb78..02f0e86 100644

drivers/net/wireless/ti/wlcore/main.c static int wl1271_op_suspend(struct ieee80211_hw *hw, · line 1792

Quoted 9 lines
drivers/net/wireless/ti/wlcore/main.c +3 -1
@@ -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.