ATH11K Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Kalle Valo <kvalo@codeaurora.org>
To: ath11k@lists.infradead.org
Subject: [PATCH 4/5] ath11k: comparison is always true due to limited range of data type [-Wtype-limits]
Date: Mon, 17 Jun 2019 19:32:58 +0300	[thread overview]
Message-ID: <1560789179-3857-4-git-send-email-kvalo@codeaurora.org> (raw)
In-Reply-To: <1560789179-3857-1-git-send-email-kvalo@codeaurora.org>

drivers/net/wireless/ath/ath11k/hal_rx.c:57:18: warning: comparison is always true due to limited range of data type [-Wtype-limits]
drivers/net/wireless/ath/ath11k/dp_rx.c:2375:21: warning: comparison is always true due to limited range of data type [-Wtype-limits]
drivers/net/wireless/ath/ath11k/dp_rx.c:2378:20: warning: comparison is always true due to limited range of data type [-Wtype-limits]
drivers/net/wireless/ath/ath11k/dp_rx.c:2382:20: warning: comparison is always true due to limited range of data type [-Wtype-limits]
drivers/net/wireless/ath/ath11k/dp_rx.c:2385:22: warning: comparison is always true due to limited range of data type [-Wtype-limits]
drivers/net/wireless/ath/ath11k/dp_rx.c:2389:21: warning: comparison is always true due to limited range of data type [-Wtype-limits]
drivers/net/wireless/ath/ath11k/dp_rx.c:2396:32: warning: comparison is always true due to limited range of data type [-Wtype-limits]

Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
---
 drivers/net/wireless/ath/ath11k/debug_htt_stats.c |  2 +-
 drivers/net/wireless/ath/ath11k/dp_rx.c           | 18 +++++++-----------
 drivers/net/wireless/ath/ath11k/hal_rx.c          |  6 +++---
 3 files changed, 11 insertions(+), 15 deletions(-)

diff --git a/drivers/net/wireless/ath/ath11k/debug_htt_stats.c b/drivers/net/wireless/ath/ath11k/debug_htt_stats.c
index 9558c6ada6d8..22d44a59be14 100644
--- a/drivers/net/wireless/ath/ath11k/debug_htt_stats.c
+++ b/drivers/net/wireless/ath/ath11k/debug_htt_stats.c
@@ -52,7 +52,7 @@ static inline void htt_print_stats_string_tlv(const u32 *tag_buf,
 		index += snprintf(&data[index],
 				HTT_MAX_STRING_LEN - index,
 				"%.*s", 4, (char *)&(htt_stats_buf->data[i]));
-		if (index < 0 || index >= HTT_MAX_STRING_LEN)
+		if (index >= HTT_MAX_STRING_LEN)
 			break;
 	}
 
diff --git a/drivers/net/wireless/ath/ath11k/dp_rx.c b/drivers/net/wireless/ath/ath11k/dp_rx.c
index 0823f6761426..2c7a3585059a 100644
--- a/drivers/net/wireless/ath/ath11k/dp_rx.c
+++ b/drivers/net/wireless/ath/ath11k/dp_rx.c
@@ -2372,29 +2372,25 @@ static void ath11k_dp_rx_update_peer_stats(struct ath11k_sta *arsta,
 	if (ppdu_info->nss > 0 && ppdu_info->nss <= HAL_RX_MAX_NSS)
 		rx_stats->nss_count[ppdu_info->nss - 1] += num_msdu;
 
-	if (ppdu_info->mcs >= 0 && ppdu_info->mcs <= HAL_RX_MAX_MCS)
+	if (ppdu_info->mcs <= HAL_RX_MAX_MCS)
 		rx_stats->mcs_count[ppdu_info->mcs] += num_msdu;
 
-	if (ppdu_info->gi >= HAL_RX_GI_0_8_US &&
-	    ppdu_info->gi < HAL_RX_GI_MAX)
+	if (ppdu_info->gi < HAL_RX_GI_MAX)
 		rx_stats->gi_count[ppdu_info->gi] += num_msdu;
 
-	if (ppdu_info->bw >= HAL_RX_BW_20MHZ && ppdu_info->bw < HAL_RX_BW_MAX)
+	if (ppdu_info->bw < HAL_RX_BW_MAX)
 		rx_stats->bw_count[ppdu_info->bw] += num_msdu;
 
-	if (ppdu_info->ldpc >= HAL_RX_SU_MU_CODING_BCC &&
-	    ppdu_info->ldpc < HAL_RX_SU_MU_CODING_MAX)
+	if (ppdu_info->ldpc < HAL_RX_SU_MU_CODING_MAX)
 		rx_stats->coding_count[ppdu_info->ldpc] += num_msdu;
 
-	if (ppdu_info->tid >= 0 && ppdu_info->tid <= IEEE80211_NUM_TIDS)
+	if (ppdu_info->tid <= IEEE80211_NUM_TIDS)
 		rx_stats->tid_count[ppdu_info->tid] += num_msdu;
 
-	if (ppdu_info->preamble_type >= HAL_RX_PREAMBLE_11A &&
-	    ppdu_info->preamble_type < HAL_RX_PREAMBLE_MAX)
+	if (ppdu_info->preamble_type < HAL_RX_PREAMBLE_MAX)
 		rx_stats->pream_cnt[ppdu_info->preamble_type] += num_msdu;
 
-	if (ppdu_info->reception_type >= HAL_RX_RECEPTION_TYPE_SU &&
-	    ppdu_info->reception_type < HAL_RX_RECEPTION_TYPE_MAX)
+	if (ppdu_info->reception_type < HAL_RX_RECEPTION_TYPE_MAX)
 		rx_stats->reception_type[ppdu_info->reception_type] += num_msdu;
 
 	if (ppdu_info->is_stbc)
diff --git a/drivers/net/wireless/ath/ath11k/hal_rx.c b/drivers/net/wireless/ath/ath11k/hal_rx.c
index 0308089c88df..ca55855db2bc 100644
--- a/drivers/net/wireless/ath/ath11k/hal_rx.c
+++ b/drivers/net/wireless/ath/ath11k/hal_rx.c
@@ -54,10 +54,10 @@ static int ath11k_hal_reo_cmd_flush_cache(struct ath11k_hal *hal, u32 *reo_desc,
 	u8 avail_slot = ffz(hal->avail_blk_resource);
 
 	if (cmd->flag & HAL_REO_CMD_FLG_FLUSH_BLOCK_LATER) {
-		if (avail_slot >= 0 && avail_slot < HAL_MAX_AVAIL_BLK_RES)
-			hal->current_blk_index = avail_slot;
-		else
+		if (avail_slot >= HAL_MAX_AVAIL_BLK_RES)
 			return -ENOSPC;
+
+		hal->current_blk_index = avail_slot;
 	}
 
 	tlv->tl = FIELD_PREP(HAL_TLV_HDR_TAG, HAL_REO_FLUSH_CACHE) |
-- 
2.7.4


_______________________________________________
ath11k mailing list
ath11k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath11k

  parent reply	other threads:[~2019-06-17 16:33 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-17 16:32 [PATCH 1/5] ath11k: 'static' is not at beginning of declaration [-Wold-style-declaration] Kalle Valo
2019-06-17 16:32 ` [PATCH 2/5] ath11k: this statement may fall through [-Wimplicit-fallthrough=] Kalle Valo
2019-06-17 16:32 ` [PATCH 3/5] ath11k: variable set but not used [-Wunused-but-set-variable] Kalle Valo
2019-06-17 16:32 ` Kalle Valo [this message]
2019-06-17 16:32 ` [PATCH 5/5] ath11k: warning: comparison of unsigned expression < 0 is always false [-Wtype-limits] Kalle Valo
2019-06-18 12:26 ` [PATCH 1/5] ath11k: 'static' is not at beginning of declaration [-Wold-style-declaration] Kalle Valo

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=1560789179-3857-4-git-send-email-kvalo@codeaurora.org \
    --to=kvalo@codeaurora.org \
    --cc=ath11k@lists.infradead.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