[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20211117063621.160695-1-ye.guojin@zte.com.cn>
Date: Wed, 17 Nov 2021 06:36:21 +0000
From: cgel.zte@...il.com
To: luciano.coelho@...el.com
Cc: kvalo@...eaurora.org, davem@...emloft.net, kuba@...nel.org,
miriam.rachel.korenblit@...el.com, ye.guojin@....com.cn,
johannes.berg@...el.com, linux-wireless@...r.kernel.org,
netdev@...r.kernel.org, linux-kernel@...r.kernel.org,
Zeal Robot <zealci@....com.cn>
Subject: [PATCH] iwlwifi: rs: fixup the return value type of iwl_legacy_rate_to_fw_idx()
From: Ye Guojin <ye.guojin@....com.cn>
This was found by coccicheck:
./drivers/net/wireless/intel/iwlwifi/fw/rs.c, 147, 10-21, WARNING
Unsigned expression compared with zero legacy_rate < 0
Reported-by: Zeal Robot <zealci@....com.cn>
Signed-off-by: Ye Guojin <ye.guojin@....com.cn>
---
drivers/net/wireless/intel/iwlwifi/fw/api/rs.h | 2 +-
drivers/net/wireless/intel/iwlwifi/fw/rs.c | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/net/wireless/intel/iwlwifi/fw/api/rs.h b/drivers/net/wireless/intel/iwlwifi/fw/api/rs.h
index a09081d7ed45..7794cd6d289d 100644
--- a/drivers/net/wireless/intel/iwlwifi/fw/api/rs.h
+++ b/drivers/net/wireless/intel/iwlwifi/fw/api/rs.h
@@ -710,7 +710,7 @@ struct iwl_lq_cmd {
u8 iwl_fw_rate_idx_to_plcp(int idx);
u32 iwl_new_rate_from_v1(u32 rate_v1);
-u32 iwl_legacy_rate_to_fw_idx(u32 rate_n_flags);
+int iwl_legacy_rate_to_fw_idx(u32 rate_n_flags);
const struct iwl_rate_mcs_info *iwl_rate_mcs(int idx);
const char *iwl_rs_pretty_ant(u8 ant);
const char *iwl_rs_pretty_bw(int bw);
diff --git a/drivers/net/wireless/intel/iwlwifi/fw/rs.c b/drivers/net/wireless/intel/iwlwifi/fw/rs.c
index a21c3befd93b..3850881210e6 100644
--- a/drivers/net/wireless/intel/iwlwifi/fw/rs.c
+++ b/drivers/net/wireless/intel/iwlwifi/fw/rs.c
@@ -142,7 +142,7 @@ u32 iwl_new_rate_from_v1(u32 rate_v1)
}
/* if legacy format */
} else {
- u32 legacy_rate = iwl_legacy_rate_to_fw_idx(rate_v1);
+ int legacy_rate = iwl_legacy_rate_to_fw_idx(rate_v1);
WARN_ON(legacy_rate < 0);
rate_v2 |= legacy_rate;
@@ -172,7 +172,7 @@ u32 iwl_new_rate_from_v1(u32 rate_v1)
}
IWL_EXPORT_SYMBOL(iwl_new_rate_from_v1);
-u32 iwl_legacy_rate_to_fw_idx(u32 rate_n_flags)
+int iwl_legacy_rate_to_fw_idx(u32 rate_n_flags)
{
int rate = rate_n_flags & RATE_LEGACY_RATE_MSK_V1;
int idx;
--
2.25.1
Powered by blists - more mailing lists