Since 'mod_timer()' expects expiration time in jiffies, add missing 'msecs_to_jiffies()' in 'ath10k_pci_rx_post_pipe()' and 'ath10k_snoc_rx_post_pipe()'. Also simplify the loops and fix number of loop iterations in the former (it should be equal to 'num' (i.e. number of buffers) and not 'num + 1'. Fixes: 728f95eef523 ("ath10k: rework posting pci rx buffers") Fixes: a6e149a9ff03 ("ath10k: add hif start/stop methods for wcn3990 snoc layer") Signed-off-by: Dmitry Antipov <dmantipov@xxxxxxxxx> --- drivers/net/wireless/ath/ath10k/pci.c | 16 +++++++--------- drivers/net/wireless/ath/ath10k/snoc.c | 14 +++++++------- 2 files changed, 14 insertions(+), 16 deletions(-) diff --git a/drivers/net/wireless/ath/ath10k/pci.c b/drivers/net/wireless/ath/ath10k/pci.c index a7f44f6335fb..c004c87d3211 100644 --- a/drivers/net/wireless/ath/ath10k/pci.c +++ b/drivers/net/wireless/ath/ath10k/pci.c @@ -818,17 +818,15 @@ static void ath10k_pci_rx_post_pipe(struct ath10k_pci_pipe *pipe) num = __ath10k_ce_rx_num_free_bufs(ce_pipe); spin_unlock_bh(&ce->ce_lock); - while (num >= 0) { + while (num--) { ret = __ath10k_pci_rx_post_buf(pipe); - if (ret) { - if (ret == -ENOSPC) - break; - ath10k_warn(ar, "failed to post pci rx buf: %d\n", ret); - mod_timer(&ar_pci->rx_post_retry, jiffies + - ATH10K_PCI_RX_POST_RETRY_MS); + if (ret) break; - } - num--; + } + if (ret != -ENOSPC) { + ath10k_warn(ar, "failed to post PCI rx buf: %d\n", ret); + mod_timer(&ar_pci->rx_post_retry, jiffies + + msecs_to_jiffies(ATH10K_PCI_RX_POST_RETRY_MS)); } } diff --git a/drivers/net/wireless/ath/ath10k/snoc.c b/drivers/net/wireless/ath/ath10k/snoc.c index 26214c00cd0d..9ced24b1b177 100644 --- a/drivers/net/wireless/ath/ath10k/snoc.c +++ b/drivers/net/wireless/ath/ath10k/snoc.c @@ -544,16 +544,16 @@ static void ath10k_snoc_rx_post_pipe(struct ath10k_snoc_pipe *pipe) spin_lock_bh(&ce->ce_lock); num = __ath10k_ce_rx_num_free_bufs(ce_pipe); spin_unlock_bh(&ce->ce_lock); + while (num--) { ret = __ath10k_snoc_rx_post_buf(pipe); - if (ret) { - if (ret == -ENOSPC) - break; - ath10k_warn(ar, "failed to post rx buf: %d\n", ret); - mod_timer(&ar_snoc->rx_post_retry, jiffies + - ATH10K_SNOC_RX_POST_RETRY_MS); + if (ret) break; - } + } + if (ret != -ENOSPC) { + ath10k_warn(ar, "failed to post SNOC rx buf: %d\n", ret); + mod_timer(&ar_snoc->rx_post_retry, jiffies + + msecs_to_jiffies(ATH10K_SNOC_RX_POST_RETRY_MS)); } } -- 2.41.0