mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Markus Elfring <Markus.Elfring@web.de>
To: ath11k@lists.infradead.org, ath12k@lists.infradead.org,
	linux-wireless@vger.kernel.org,
	Jeff Johnson <jjohnson@kernel.org>, Kalle Valo <kvalo@kernel.org>
Cc: LKML <linux-kernel@vger.kernel.org>,
	Julia Lawall <julia.lawall@inria.fr>
Subject: [PATCH] wifi: ath: Use dev_kfree_skb_any(skb) call only once in three functions
Date: Sat, 21 Sep 2024 16:43:20 +0200	[thread overview]
Message-ID: <6658a046-9d4e-4f18-8405-f5dadcf410ee@web.de> (raw)

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(-)

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;
 	}
--
2.46.0


                 reply	other threads:[~2024-09-21 14:43 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6658a046-9d4e-4f18-8405-f5dadcf410ee@web.de \
    --to=markus.elfring@web.de \
    --cc=ath11k@lists.infradead.org \
    --cc=ath12k@lists.infradead.org \
    --cc=jjohnson@kernel.org \
    --cc=julia.lawall@inria.fr \
    --cc=kvalo@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®