diff mbox series

wifi: ath: Use dev_kfree_skb_any(skb) call only once in three functions

Message ID 6658a046-9d4e-4f18-8405-f5dadcf410ee@web.de (mailing list archive)
State Rejected
Delegated to: Jeff Johnson
Headers show
Series wifi: ath: Use dev_kfree_skb_any(skb) call only once in three functions | expand

Commit Message

Markus Elfring Sept. 21, 2024, 2:43 p.m. UTC
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sat, 21 Sep 2024 16:32:09 +0200

A dev_kfree_skb_any(skb) call was immediately used after a return code
check in three function implementations.
Thus use such a function call only once instead directly before the checks.

This issue was transformed by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/net/wireless/ath/ath11k/dp_rx.c  | 6 ++----
 drivers/net/wireless/ath/ath12k/dp_mon.c | 4 +---
 drivers/net/wireless/ath/ath12k/dp_rx.c  | 6 ++----
 3 files changed, 5 insertions(+), 11 deletions(-)

--
2.46.0
diff mbox series

Patch

diff --git a/drivers/net/wireless/ath/ath11k/dp_rx.c b/drivers/net/wireless/ath/ath11k/dp_rx.c
index c087d8a0f5b2..eb8e5fbdd77a 100644
--- a/drivers/net/wireless/ath/ath11k/dp_rx.c
+++ b/drivers/net/wireless/ath/ath11k/dp_rx.c
@@ -1808,11 +1808,9 @@  static int ath11k_dp_rx_msdu_coalesce(struct ath11k *ar,
 		/* Free up all buffers of the MSDU */
 		while ((skb = __skb_dequeue(msdu_list)) != NULL) {
 			rxcb = ATH11K_SKB_RXCB(skb);
-			if (!rxcb->is_continuation) {
-				dev_kfree_skb_any(skb);
-				break;
-			}
 			dev_kfree_skb_any(skb);
+			if (!rxcb->is_continuation)
+				break;
 		}
 		return -ENOMEM;
 	}
diff --git a/drivers/net/wireless/ath/ath12k/dp_mon.c b/drivers/net/wireless/ath/ath12k/dp_mon.c
index 5c6749bc4039..21780f06b4ae 100644
--- a/drivers/net/wireless/ath/ath12k/dp_mon.c
+++ b/drivers/net/wireless/ath/ath12k/dp_mon.c
@@ -2102,16 +2102,14 @@  int ath12k_dp_mon_srng_process(struct ath12k *ar, int mac_id, int *budget,
 								  skb, napi, ppdu_id);

 			peer = ath12k_peer_find_by_id(ab, ppdu_info->peer_id);
-
+			dev_kfree_skb_any(skb);
 			if (!peer || !peer->sta) {
 				ath12k_dbg(ab, ATH12K_DBG_DATA,
 					   "failed to find the peer with peer_id %d\n",
 					   ppdu_info->peer_id);
-				dev_kfree_skb_any(skb);
 				continue;
 			}

-			dev_kfree_skb_any(skb);
 			pmon->dest_skb_q[i] = NULL;
 		}

diff --git a/drivers/net/wireless/ath/ath12k/dp_rx.c b/drivers/net/wireless/ath/ath12k/dp_rx.c
index 91e3393f7b5f..c0b59ac247bf 100644
--- a/drivers/net/wireless/ath/ath12k/dp_rx.c
+++ b/drivers/net/wireless/ath/ath12k/dp_rx.c
@@ -1804,11 +1804,9 @@  static int ath12k_dp_rx_msdu_coalesce(struct ath12k *ar,
 		/* Free up all buffers of the MSDU */
 		while ((skb = __skb_dequeue(msdu_list)) != NULL) {
 			rxcb = ATH12K_SKB_RXCB(skb);
-			if (!rxcb->is_continuation) {
-				dev_kfree_skb_any(skb);
-				break;
-			}
 			dev_kfree_skb_any(skb);
+			if (!rxcb->is_continuation)
+				break;
 		}
 		return -ENOMEM;
 	}