wifi: ath12k: Refactor error handler of Rxdma replenish
authorKarthikeyan Periyasamy <quic_periyasa@quicinc.com>
Wed, 20 Mar 2024 01:06:15 +0000 (06:36 +0530)
committerKalle Valo <quic_kvalo@quicinc.com>
Thu, 21 Mar 2024 11:38:13 +0000 (13:38 +0200)
The Rxdma replenish handler currently contains redundant code in both the
success and error cases. To avoid the redundant code, implement a
conditional jump mechanism by placing a goto statement to prevent
unnecessary execution of the error handling code when the operation is
successful. This change streamline the code readability and enhance its
efficiency.

Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.0.1-00029-QCAHKSWPL_SILICONZ-1

Signed-off-by: Karthikeyan Periyasamy <quic_periyasa@quicinc.com>
Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
Link: https://msgid.link/20240320010615.91331-4-quic_periyasa@quicinc.com
drivers/net/wireless/ath/ath12k/dp_rx.c

index 2a0e4faadcf1e555c31ff40e65ffe6d5357dbf71..a593beecdd12231cc493e3c31d57c5c742e67e3f 100644 (file)
@@ -337,7 +337,7 @@ int ath12k_dp_rx_bufs_replenish(struct ath12k_base *ab,
        num_remain = req_entries;
 
        if (!num_remain)
-               goto skip_replenish;
+               goto out;
 
        /* Get the descriptor from free list */
        if (list_empty(used_list)) {
@@ -389,22 +389,14 @@ int ath12k_dp_rx_bufs_replenish(struct ath12k_base *ab,
                ath12k_hal_rx_buf_addr_info_set(desc, paddr, cookie, mgr);
        }
 
-skip_replenish:
-       ath12k_hal_srng_access_end(ab, srng);
-
-       if (!list_empty(used_list))
-               ath12k_dp_rx_enqueue_free(dp, used_list);
-
-       spin_unlock_bh(&srng->lock);
-
-       return req_entries - num_remain;
+       goto out;
 
 fail_dma_unmap:
        dma_unmap_single(ab->dev, paddr, skb->len + skb_tailroom(skb),
                         DMA_FROM_DEVICE);
 fail_free_skb:
        dev_kfree_skb_any(skb);
-
+out:
        ath12k_hal_srng_access_end(ab, srng);
 
        if (!list_empty(used_list))