Skip to contentSkip to conversation

staging: wfx: unlock on error path

PATCH In review Dan Carpenter 2 participants 2 messages May 12, 2020

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

PATCH 1/1 staging: wfx: unlock on error path

We need to release the tx_lock on the error path before returning.

Fixes d1c015b4ef6f ("staging: wfx: rewrite wfx_hw_scan()")

---
From static analysis. Not tested.

 drivers/staging/wfx/scan.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/staging/wfx/scan.c +3 -1
index 76761e4960dd7..eff1be9fb28f8 100644
@@ -57,8 +57,10 @@ static int send_scan_req(struct wfx_vif *wvif,
 	wvif->scan_abort = false;
 	reinit_completion(&wvif->scan_complete);
 	timeout = hif_scan(wvif, req, start_idx, i - start_idx);
-	if (timeout < 0)
+	if (timeout < 0) {
+		wfx_tx_unlock(wvif->wdev);
 		return timeout;
+	}
 	ret = wait_for_completion_timeout(&wvif->scan_complete, timeout);
 	if (req->channels[start_idx]->max_power != wvif->vif->bss_conf.txpower)
 		hif_set_output_power(wvif, wvif->vif->bss_conf.txpower);
Signature · 1 line
2.26.2
Reviewed-by on v1 1/1
#1 lore raw
Quoted 28 lines · On Tuesday 12 May 2020 10:36:56 CEST Dan Carpenter wrote:

We need to release the tx_lock on the error path before returning.

Fixes d1c015b4ef6f ("staging: wfx: rewrite wfx_hw_scan()")

---
From static analysis. Not tested.

 drivers/staging/wfx/scan.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/staging/wfx/scan.c +3 -2
index 76761e4960dd7..eff1be9fb28f8 100644
@@ -57,8 +57,10 @@ static int send_scan_req(struct wfx_vif *wvif,
        wvif->scan_abort = false;
        reinit_completion(&wvif->scan_complete);
        timeout = hif_scan(wvif, req, start_idx, i - start_idx);
-       if (timeout < 0)
+       if (timeout < 0) {
+               wfx_tx_unlock(wvif->wdev);
                return timeout;
+       }
        ret = wait_for_completion_timeout(&wvif->scan_complete, timeout);
        if (req->channels[start_idx]->max_power != wvif->vif->bss_conf.txpower)
                hif_set_output_power(wvif, wvif->vif->bss_conf.txpower);
--
Quoted 3 lines

2.26.2

Good catch!

Signature · 1 line
Jérôme Pouiller