Skip to content

Commit

Permalink
wlcore: fix runtime pm imbalance in wlcore_irq_locked
Browse files Browse the repository at this point in the history
When wlcore_fw_status() returns an error code, a pairing
runtime PM usage counter decrement is needed to keep the
counter balanced. It's the same for all error paths after
wlcore_fw_status().

Signed-off-by: Dinghao Liu <dinghao.liu@zju.edu.cn>
Acked-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20200522044906.29564-1-dinghao.liu@zju.edu.cn
  • Loading branch information
Dinghao Liu authored and Kalle Valo committed May 29, 2020
1 parent 7967af8 commit da74b69
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions drivers/net/wireless/ti/wlcore/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -548,7 +548,7 @@ static int wlcore_irq_locked(struct wl1271 *wl)

ret = wlcore_fw_status(wl, wl->fw_status);
if (ret < 0)
goto out;
goto err_ret;

wlcore_hw_tx_immediate_compl(wl);

Expand All @@ -565,7 +565,7 @@ static int wlcore_irq_locked(struct wl1271 *wl)
ret = -EIO;

/* restarting the chip. ignore any other interrupt. */
goto out;
goto err_ret;
}

if (unlikely(intr & WL1271_ACX_SW_INTR_WATCHDOG)) {
Expand All @@ -575,15 +575,15 @@ static int wlcore_irq_locked(struct wl1271 *wl)
ret = -EIO;

/* restarting the chip. ignore any other interrupt. */
goto out;
goto err_ret;
}

if (likely(intr & WL1271_ACX_INTR_DATA)) {
wl1271_debug(DEBUG_IRQ, "WL1271_ACX_INTR_DATA");

ret = wlcore_rx(wl, wl->fw_status);
if (ret < 0)
goto out;
goto err_ret;

/* Check if any tx blocks were freed */
spin_lock_irqsave(&wl->wl_lock, flags);
Expand All @@ -596,15 +596,15 @@ static int wlcore_irq_locked(struct wl1271 *wl)
*/
ret = wlcore_tx_work_locked(wl);
if (ret < 0)
goto out;
goto err_ret;
} else {
spin_unlock_irqrestore(&wl->wl_lock, flags);
}

/* check for tx results */
ret = wlcore_hw_tx_delayed_compl(wl);
if (ret < 0)
goto out;
goto err_ret;

/* Make sure the deferred queues don't get too long */
defer_count = skb_queue_len(&wl->deferred_tx_queue) +
Expand All @@ -617,14 +617,14 @@ static int wlcore_irq_locked(struct wl1271 *wl)
wl1271_debug(DEBUG_IRQ, "WL1271_ACX_INTR_EVENT_A");
ret = wl1271_event_handle(wl, 0);
if (ret < 0)
goto out;
goto err_ret;
}

if (intr & WL1271_ACX_INTR_EVENT_B) {
wl1271_debug(DEBUG_IRQ, "WL1271_ACX_INTR_EVENT_B");
ret = wl1271_event_handle(wl, 1);
if (ret < 0)
goto out;
goto err_ret;
}

if (intr & WL1271_ACX_INTR_INIT_COMPLETE)
Expand All @@ -635,6 +635,7 @@ static int wlcore_irq_locked(struct wl1271 *wl)
wl1271_debug(DEBUG_IRQ, "WL1271_ACX_INTR_HW_AVAILABLE");
}

err_ret:
pm_runtime_mark_last_busy(wl->dev);
pm_runtime_put_autosuspend(wl->dev);

Expand Down

0 comments on commit da74b69

Please sign in to comment.