From: Luca Coelho <luca@coelho.fi>
To: kvalo@codeaurora.org
Cc: linux-wireless@vger.kernel.org,
Dan Carpenter <dan.carpenter@oracle.com>,
Luca Coelho <luciano.coelho@intel.com>
Subject: [PATCH 03/20] iwlwifi: remove some unnecessary NULL checks
Date: Fri, 28 Jun 2019 12:19:51 +0300 [thread overview]
Message-ID: <20190628092008.11049-4-luca@coelho.fi> (raw)
In-Reply-To: <20190628092008.11049-1-luca@coelho.fi>
From: Dan Carpenter <dan.carpenter@oracle.com>
These pointers are an offset into the "sta" struct. They're assigned
like this:
const struct ieee80211_sta_vht_cap *vht_cap = &sta->vht_cap;
They're not the first member of the struct (->supp_rates[] is first) so
they can't be NULL.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
---
.../net/wireless/intel/iwlwifi/mvm/rs-fw.c | 23 +++++++++----------
1 file changed, 11 insertions(+), 12 deletions(-)
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/rs-fw.c b/drivers/net/wireless/intel/iwlwifi/mvm/rs-fw.c
index 1cfd550c1ecb..b409e69cb1a4 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/rs-fw.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/rs-fw.c
@@ -101,7 +101,7 @@ static u8 rs_fw_sgi_cw_support(struct ieee80211_sta *sta)
struct ieee80211_sta_he_cap *he_cap = &sta->he_cap;
u8 supp = 0;
- if (he_cap && he_cap->has_he)
+ if (he_cap->has_he)
return 0;
if (ht_cap->cap & IEEE80211_HT_CAP_SGI_20)
@@ -123,12 +123,12 @@ static u16 rs_fw_get_config_flags(struct iwl_mvm *mvm,
struct ieee80211_sta_ht_cap *ht_cap = &sta->ht_cap;
struct ieee80211_sta_vht_cap *vht_cap = &sta->vht_cap;
struct ieee80211_sta_he_cap *he_cap = &sta->he_cap;
- bool vht_ena = vht_cap && vht_cap->vht_supported;
+ bool vht_ena = vht_cap->vht_supported;
u16 flags = 0;
if (mvm->cfg->ht_params->stbc &&
(num_of_ant(iwl_mvm_get_valid_tx_ant(mvm)) > 1)) {
- if (he_cap && he_cap->has_he) {
+ if (he_cap->has_he) {
if (he_cap->he_cap_elem.phy_cap_info[2] &
IEEE80211_HE_PHY_CAP2_STBC_RX_UNDER_80MHZ)
flags |= IWL_TLC_MNG_CFG_FLAGS_STBC_MSK;
@@ -136,15 +136,14 @@ static u16 rs_fw_get_config_flags(struct iwl_mvm *mvm,
if (he_cap->he_cap_elem.phy_cap_info[7] &
IEEE80211_HE_PHY_CAP7_STBC_RX_ABOVE_80MHZ)
flags |= IWL_TLC_MNG_CFG_FLAGS_HE_STBC_160MHZ_MSK;
- } else if ((ht_cap &&
- (ht_cap->cap & IEEE80211_HT_CAP_RX_STBC)) ||
+ } else if ((ht_cap->cap & IEEE80211_HT_CAP_RX_STBC) ||
(vht_ena &&
(vht_cap->cap & IEEE80211_VHT_CAP_RXSTBC_MASK)))
flags |= IWL_TLC_MNG_CFG_FLAGS_STBC_MSK;
}
if (mvm->cfg->ht_params->ldpc &&
- ((ht_cap && (ht_cap->cap & IEEE80211_HT_CAP_LDPC_CODING)) ||
+ ((ht_cap->cap & IEEE80211_HT_CAP_LDPC_CODING) ||
(vht_ena && (vht_cap->cap & IEEE80211_VHT_CAP_RXLDPC))))
flags |= IWL_TLC_MNG_CFG_FLAGS_LDPC_MSK;
@@ -154,7 +153,7 @@ static u16 rs_fw_get_config_flags(struct iwl_mvm *mvm,
IEEE80211_HE_PHY_CAP1_LDPC_CODING_IN_PAYLOAD))
flags &= ~IWL_TLC_MNG_CFG_FLAGS_LDPC_MSK;
- if (he_cap && he_cap->has_he &&
+ if (he_cap->has_he &&
(he_cap->he_cap_elem.phy_cap_info[3] &
IEEE80211_HE_PHY_CAP3_DCM_MAX_CONST_RX_MASK))
flags |= IWL_TLC_MNG_CFG_FLAGS_HE_DCM_NSS_1_MSK;
@@ -293,13 +292,13 @@ static void rs_fw_set_supp_rates(struct ieee80211_sta *sta,
cmd->mode = IWL_TLC_MNG_MODE_NON_HT;
/* HT/VHT rates */
- if (he_cap && he_cap->has_he) {
+ if (he_cap->has_he) {
cmd->mode = IWL_TLC_MNG_MODE_HE;
rs_fw_he_set_enabled_rates(sta, sband, cmd);
- } else if (vht_cap && vht_cap->vht_supported) {
+ } else if (vht_cap->vht_supported) {
cmd->mode = IWL_TLC_MNG_MODE_VHT;
rs_fw_vht_set_enabled_rates(sta, vht_cap, cmd);
- } else if (ht_cap && ht_cap->ht_supported) {
+ } else if (ht_cap->ht_supported) {
cmd->mode = IWL_TLC_MNG_MODE_HT;
cmd->ht_rates[0][0] = cpu_to_le16(ht_cap->mcs.rx_mask[0]);
cmd->ht_rates[1][0] = cpu_to_le16(ht_cap->mcs.rx_mask[1]);
@@ -381,7 +380,7 @@ static u16 rs_fw_get_max_amsdu_len(struct ieee80211_sta *sta)
const struct ieee80211_sta_vht_cap *vht_cap = &sta->vht_cap;
const struct ieee80211_sta_ht_cap *ht_cap = &sta->ht_cap;
- if (vht_cap && vht_cap->vht_supported) {
+ if (vht_cap->vht_supported) {
switch (vht_cap->cap & IEEE80211_VHT_CAP_MAX_MPDU_MASK) {
case IEEE80211_VHT_CAP_MAX_MPDU_LENGTH_11454:
return IEEE80211_MAX_MPDU_LEN_VHT_11454;
@@ -391,7 +390,7 @@ static u16 rs_fw_get_max_amsdu_len(struct ieee80211_sta *sta)
return IEEE80211_MAX_MPDU_LEN_VHT_3895;
}
- } else if (ht_cap && ht_cap->ht_supported) {
+ } else if (ht_cap->ht_supported) {
if (ht_cap->cap & IEEE80211_HT_CAP_MAX_AMSDU)
/*
* agg is offloaded so we need to assume that agg
--
2.20.1
next prev parent reply other threads:[~2019-06-28 9:20 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-28 9:19 [PATCH 00/20] iwlwifi: updates intended for v5.3 2019-06-28 Luca Coelho
2019-06-28 9:19 ` [PATCH 01/20] iwlwifi: lib: Use struct_size() helper Luca Coelho
2019-06-28 9:19 ` [PATCH 02/20] iwlwifi: d3: " Luca Coelho
2019-06-28 9:19 ` Luca Coelho [this message]
2019-06-28 9:19 ` [PATCH 04/20] iwlwifi: mvm: correctly fill the ac array in the iwl_mac_ctx_cmd Luca Coelho
2019-06-28 9:19 ` [PATCH 05/20] iwlwifi: mvm: convert to FW AC when configuring MU EDCA Luca Coelho
2019-06-28 9:19 ` [PATCH 06/20] iwlwifi: fix module init error paths Luca Coelho
2019-06-28 9:19 ` [PATCH 07/20] iwlwifi: Add support for SAR South Korea limitation Luca Coelho
2019-06-28 9:19 ` [PATCH 08/20] iwlwifi: mvm: Add log information about SAR status Luca Coelho
2019-09-30 12:06 ` Matteo Croce
2019-09-30 12:12 ` Luca Coelho
2019-06-28 9:19 ` [PATCH 09/20] iwlwifi: mvm: Drop large non sta frames Luca Coelho
2019-06-28 9:19 ` [PATCH 10/20] iwlwifi: pcie: increase the size of PCI dumps Luca Coelho
2019-06-28 9:19 ` [PATCH 11/20] iwlwifi: dbg: fix debug monitor stop and restart delays Luca Coelho
2019-06-28 9:20 ` [PATCH 12/20] iwlwifi: dbg_ini: enforce apply point early on buffer allocation tlv Luca Coelho
2019-06-28 9:20 ` [PATCH 13/20] iwlwifi: dbg_ini: remove redundant checking of ini mode Luca Coelho
2019-06-28 9:20 ` [PATCH 14/20] iwlwifi: dbg: move trans debug fields to a separate struct Luca Coelho
2019-06-28 9:20 ` [PATCH 15/20] iwlwifi: support FSEQ TLV even when FMAC is not compiled Luca Coelho
2019-06-28 9:20 ` [PATCH 16/20] iwlwifi: mvm: make the usage of TWT configurable Luca Coelho
2019-06-28 9:20 ` [PATCH 17/20] iwlwifi: dbg_ini: fix debug monitor stop and restart in ini mode Luca Coelho
2019-06-28 9:20 ` [PATCH 18/20] iwlwifi: dbg: don't stop dbg recording before entering D3 from 9000 devices Luca Coelho
2019-06-28 9:20 ` [PATCH 19/20] iwlwifi: dbg: debug recording stop and restart command remove Luca Coelho
2019-06-28 9:20 ` [PATCH 20/20] iwlwifi: mvm: remove MAC_FILTER_IN_11AX for AP mode Luca Coelho
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=20190628092008.11049-4-luca@coelho.fi \
--to=luca@coelho.fi \
--cc=dan.carpenter@oracle.com \
--cc=kvalo@codeaurora.org \
--cc=linux-wireless@vger.kernel.org \
--cc=luciano.coelho@intel.com \
/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;
as well as URLs for NNTP newsgroup(s).