linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ath11k: Remove unused variable in ath11k_dp_rx_mon_merg_msdus()
@ 2021-09-27 15:07 Tim Gardner
  2021-10-05 14:29 ` Kalle Valo
  0 siblings, 1 reply; 2+ messages in thread
From: Tim Gardner @ 2021-09-27 15:07 UTC (permalink / raw)
  To: ath11k
  Cc: tim.gardner, Kalle Valo, David S. Miller, Jakub Kicinski,
	linux-wireless, netdev, linux-kernel

Coverity complains that a constant variable guards dead code. In fact,
mpdu_buf is set NULL and never updated.

4834err_merge_fail:
    	null: At condition mpdu_buf, the value of mpdu_buf must be NULL.
    	dead_error_condition: The condition mpdu_buf cannot be true.
CID 92162 (#1 of 1): 'Constant' variable guards dead code (DEADCODE)
dead_error_line: Execution cannot reach the expression decap_format !=
  DP_RX_DECAP_TYPE_RAW inside this statement: if (mpdu_buf && decap_forma....
Local variable mpdu_buf is assigned only once, to a constant value, making it
  effectively constant throughout its scope. If this is not the intent, examine
  the logic to see if there is a missing assignment that would make mpdu_buf not
  remain constant.
4835        if (mpdu_buf && decap_format != DP_RX_DECAP_TYPE_RAW) {

Fix this by removing mpdu_buf and unreachable code.

Cc: Kalle Valo <kvalo@codeaurora.org>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Jakub Kicinski <kuba@kernel.org>
Cc: ath11k@lists.infradead.org
Cc: linux-wireless@vger.kernel.org
Cc: netdev@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
---
 drivers/net/wireless/ath/ath11k/dp_rx.c | 10 +---------
 1 file changed, 1 insertion(+), 9 deletions(-)

diff --git a/drivers/net/wireless/ath/ath11k/dp_rx.c b/drivers/net/wireless/ath/ath11k/dp_rx.c
index 9a224817630a..7d57952fd73c 100644
--- a/drivers/net/wireless/ath/ath11k/dp_rx.c
+++ b/drivers/net/wireless/ath/ath11k/dp_rx.c
@@ -4740,7 +4740,7 @@ ath11k_dp_rx_mon_merg_msdus(struct ath11k *ar,
 			    struct ieee80211_rx_status *rxs)
 {
 	struct ath11k_base *ab = ar->ab;
-	struct sk_buff *msdu, *mpdu_buf, *prev_buf;
+	struct sk_buff *msdu, *prev_buf;
 	u32 wifi_hdr_len;
 	struct hal_rx_desc *rx_desc;
 	char *hdr_desc;
@@ -4748,8 +4748,6 @@ ath11k_dp_rx_mon_merg_msdus(struct ath11k *ar,
 	struct ieee80211_hdr_3addr *wh;
 	struct rx_attention *rx_attention;
 
-	mpdu_buf = NULL;
-
 	if (!head_msdu)
 		goto err_merge_fail;
 
@@ -4832,12 +4830,6 @@ ath11k_dp_rx_mon_merg_msdus(struct ath11k *ar,
 	return head_msdu;
 
 err_merge_fail:
-	if (mpdu_buf && decap_format != DP_RX_DECAP_TYPE_RAW) {
-		ath11k_dbg(ab, ATH11K_DBG_DATA,
-			   "err_merge_fail mpdu_buf %pK", mpdu_buf);
-		/* Free the head buffer */
-		dev_kfree_skb_any(mpdu_buf);
-	}
 	return NULL;
 }
 
-- 
2.33.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] ath11k: Remove unused variable in ath11k_dp_rx_mon_merg_msdus()
  2021-09-27 15:07 [PATCH] ath11k: Remove unused variable in ath11k_dp_rx_mon_merg_msdus() Tim Gardner
@ 2021-10-05 14:29 ` Kalle Valo
  0 siblings, 0 replies; 2+ messages in thread
From: Kalle Valo @ 2021-10-05 14:29 UTC (permalink / raw)
  To: Tim Gardner
  Cc: ath11k, tim.gardner, David S. Miller, Jakub Kicinski,
	linux-wireless, netdev, linux-kernel

Tim Gardner <tim.gardner@canonical.com> wrote:

> Coverity complains that a constant variable guards dead code. In fact,
> mpdu_buf is set NULL and never updated.
> 
> 4834err_merge_fail:
>         null: At condition mpdu_buf, the value of mpdu_buf must be NULL.
>         dead_error_condition: The condition mpdu_buf cannot be true.
> CID 92162 (#1 of 1): 'Constant' variable guards dead code (DEADCODE)
> dead_error_line: Execution cannot reach the expression decap_format !=
>   DP_RX_DECAP_TYPE_RAW inside this statement: if (mpdu_buf && decap_forma....
> Local variable mpdu_buf is assigned only once, to a constant value, making it
>   effectively constant throughout its scope. If this is not the intent, examine
>   the logic to see if there is a missing assignment that would make mpdu_buf not
>   remain constant.
> 4835        if (mpdu_buf && decap_format != DP_RX_DECAP_TYPE_RAW) {
> 
> Fix this by removing mpdu_buf and unreachable code.
> 
> Cc: Kalle Valo <kvalo@codeaurora.org>
> Cc: "David S. Miller" <davem@davemloft.net>
> Cc: Jakub Kicinski <kuba@kernel.org>
> Cc: ath11k@lists.infradead.org
> Cc: linux-wireless@vger.kernel.org
> Cc: netdev@vger.kernel.org
> Cc: linux-kernel@vger.kernel.org
> Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>

Patch applied to ath-next branch of ath.git, thanks.

7210b4b77fe4 ath11k: Remove unused variable in ath11k_dp_rx_mon_merg_msdus()

-- 
https://patchwork.kernel.org/project/linux-wireless/patch/20210927150743.19816-1-tim.gardner@canonical.com/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-10-05 14:29 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-27 15:07 [PATCH] ath11k: Remove unused variable in ath11k_dp_rx_mon_merg_msdus() Tim Gardner
2021-10-05 14:29 ` Kalle Valo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).