aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSudip Mukherjee <sudipm.mukherjee@gmail.com>2014-11-07 06:20:46 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2014-11-07 12:47:29 -0500
commitd48037f9169f653d1124eb75157293d875e7e57f (patch)
tree018494c15b8196f93139af9fe86bd8c9d861f876
parentc78a964c251bb82aa3454440e082b91a836105ae (diff)
staging: rtl8188eu: unneeded NULL check
before these NULL checks we are already checking it for NULL, and if it is NULL then we are jumping to the error label and handling the error before returning. So we can reach this part of the code only if the variable is known to be not NULL, and if we already know that it is not NULL, then no need to check it again. Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/staging/rtl8188eu/core/rtw_xmit.c4
-rw-r--r--drivers/staging/rtl8188eu/hal/rtl8188e_dm.c30
2 files changed, 16 insertions, 18 deletions
diff --git a/drivers/staging/rtl8188eu/core/rtw_xmit.c b/drivers/staging/rtl8188eu/core/rtw_xmit.c
index a0bbf9093338..7a71df167464 100644
--- a/drivers/staging/rtl8188eu/core/rtw_xmit.c
+++ b/drivers/staging/rtl8188eu/core/rtw_xmit.c
@@ -1025,8 +1025,7 @@ s32 rtw_xmitframe_coalesce(struct adapter *padapter, struct sk_buff *pkt, struct
1025 1025
1026 /* adding icv, if necessary... */ 1026 /* adding icv, if necessary... */
1027 if (pattrib->iv_len) { 1027 if (pattrib->iv_len) {
1028 if (psta != NULL) { 1028 switch (pattrib->encrypt) {
1029 switch (pattrib->encrypt) {
1030 case _WEP40_: 1029 case _WEP40_:
1031 case _WEP104_: 1030 case _WEP104_:
1032 WEP_IV(pattrib->iv, psta->dot11txpn, pattrib->key_idx); 1031 WEP_IV(pattrib->iv, psta->dot11txpn, pattrib->key_idx);
@@ -1043,7 +1042,6 @@ s32 rtw_xmitframe_coalesce(struct adapter *padapter, struct sk_buff *pkt, struct
1043 else 1042 else
1044 AES_IV(pattrib->iv, psta->dot11txpn, 0); 1043 AES_IV(pattrib->iv, psta->dot11txpn, 0);
1045 break; 1044 break;
1046 }
1047 } 1045 }
1048 1046
1049 memcpy(pframe, pattrib->iv, pattrib->iv_len); 1047 memcpy(pframe, pattrib->iv, pattrib->iv_len);
diff --git a/drivers/staging/rtl8188eu/hal/rtl8188e_dm.c b/drivers/staging/rtl8188eu/hal/rtl8188e_dm.c
index dab4c337a863..01566210bbd2 100644
--- a/drivers/staging/rtl8188eu/hal/rtl8188e_dm.c
+++ b/drivers/staging/rtl8188eu/hal/rtl8188e_dm.c
@@ -155,6 +155,8 @@ void rtl8188e_HalDmWatchDog(struct adapter *Adapter)
155 bool fw_ps_awake = true; 155 bool fw_ps_awake = true;
156 u8 hw_init_completed = false; 156 u8 hw_init_completed = false;
157 struct hal_data_8188e *hal_data = GET_HAL_DATA(Adapter); 157 struct hal_data_8188e *hal_data = GET_HAL_DATA(Adapter);
158 struct mlme_priv *pmlmepriv = NULL;
159 u8 bLinked = false;
158 160
159 hw_init_completed = Adapter->hw_init_completed; 161 hw_init_completed = Adapter->hw_init_completed;
160 162
@@ -170,22 +172,20 @@ void rtl8188e_HalDmWatchDog(struct adapter *Adapter)
170 fw_ps_awake = false; 172 fw_ps_awake = false;
171 173
172 /* ODM */ 174 /* ODM */
173 if (hw_init_completed) { 175 pmlmepriv = &Adapter->mlmepriv;
174 struct mlme_priv *pmlmepriv = &Adapter->mlmepriv; 176
175 u8 bLinked = false; 177 if ((check_fwstate(pmlmepriv, WIFI_AP_STATE)) ||
176 178 (check_fwstate(pmlmepriv, WIFI_ADHOC_STATE |
177 if ((check_fwstate(pmlmepriv, WIFI_AP_STATE)) || 179 WIFI_ADHOC_MASTER_STATE))) {
178 (check_fwstate(pmlmepriv, WIFI_ADHOC_STATE | WIFI_ADHOC_MASTER_STATE))) { 180 if (Adapter->stapriv.asoc_sta_count > 2)
179 if (Adapter->stapriv.asoc_sta_count > 2) 181 bLinked = true;
180 bLinked = true; 182 } else {/* Station mode */
181 } else {/* Station mode */ 183 if (check_fwstate(pmlmepriv, _FW_LINKED))
182 if (check_fwstate(pmlmepriv, _FW_LINKED)) 184 bLinked = true;
183 bLinked = true;
184 }
185
186 ODM_CmnInfoUpdate(&hal_data->odmpriv, ODM_CMNINFO_LINK, bLinked);
187 ODM_DMWatchdog(&hal_data->odmpriv);
188 } 185 }
186
187 ODM_CmnInfoUpdate(&hal_data->odmpriv, ODM_CMNINFO_LINK, bLinked);
188 ODM_DMWatchdog(&hal_data->odmpriv);
189skip_dm: 189skip_dm:
190 /* Check GPIO to determine current RF on/off and Pbc status. */ 190 /* Check GPIO to determine current RF on/off and Pbc status. */
191 /* Check Hardware Radio ON/OFF or not */ 191 /* Check Hardware Radio ON/OFF or not */