staging: rtl8188eu: unneeded NULL check
authorSudip Mukherjee <sudipm.mukherjee@gmail.com>
Fri, 7 Nov 2014 11:20:46 +0000 (16:50 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 7 Nov 2014 17:47:29 +0000 (09:47 -0800)
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>
drivers/staging/rtl8188eu/core/rtw_xmit.c
drivers/staging/rtl8188eu/hal/rtl8188e_dm.c

index a0bbf90933385c15f81e22c04037fca879516bbc..7a71df167464ea0ce622936806e13498c9d965b8 100644 (file)
@@ -1025,8 +1025,7 @@ s32 rtw_xmitframe_coalesce(struct adapter *padapter, struct sk_buff *pkt, struct
 
                /* adding icv, if necessary... */
                if (pattrib->iv_len) {
-                       if (psta != NULL) {
-                               switch (pattrib->encrypt) {
+                       switch (pattrib->encrypt) {
                                case _WEP40_:
                                case _WEP104_:
                                        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
                                        else
                                                AES_IV(pattrib->iv, psta->dot11txpn, 0);
                                        break;
-                               }
                        }
 
                        memcpy(pframe, pattrib->iv, pattrib->iv_len);
index dab4c337a8632ea39e6bac6d07e44cf73fdd9cf3..01566210bbd21146e854ab6e0a736ec642253bad 100644 (file)
@@ -155,6 +155,8 @@ void rtl8188e_HalDmWatchDog(struct adapter *Adapter)
        bool fw_ps_awake = true;
        u8 hw_init_completed = false;
        struct hal_data_8188e *hal_data = GET_HAL_DATA(Adapter);
+       struct mlme_priv *pmlmepriv = NULL;
+       u8 bLinked = false;
 
        hw_init_completed = Adapter->hw_init_completed;
 
@@ -170,22 +172,20 @@ void rtl8188e_HalDmWatchDog(struct adapter *Adapter)
                fw_ps_awake = false;
 
        /* ODM */
-       if (hw_init_completed) {
-               struct mlme_priv *pmlmepriv = &Adapter->mlmepriv;
-               u8 bLinked = false;
-
-               if ((check_fwstate(pmlmepriv, WIFI_AP_STATE)) ||
-                   (check_fwstate(pmlmepriv, WIFI_ADHOC_STATE | WIFI_ADHOC_MASTER_STATE))) {
-                       if (Adapter->stapriv.asoc_sta_count > 2)
-                               bLinked = true;
-               } else {/* Station mode */
-                       if (check_fwstate(pmlmepriv, _FW_LINKED))
-                               bLinked = true;
-               }
-
-               ODM_CmnInfoUpdate(&hal_data->odmpriv, ODM_CMNINFO_LINK, bLinked);
-               ODM_DMWatchdog(&hal_data->odmpriv);
+       pmlmepriv = &Adapter->mlmepriv;
+
+       if ((check_fwstate(pmlmepriv, WIFI_AP_STATE)) ||
+           (check_fwstate(pmlmepriv, WIFI_ADHOC_STATE |
+                          WIFI_ADHOC_MASTER_STATE))) {
+               if (Adapter->stapriv.asoc_sta_count > 2)
+                       bLinked = true;
+       } else {/* Station mode */
+               if (check_fwstate(pmlmepriv, _FW_LINKED))
+                       bLinked = true;
        }
+
+       ODM_CmnInfoUpdate(&hal_data->odmpriv, ODM_CMNINFO_LINK, bLinked);
+       ODM_DMWatchdog(&hal_data->odmpriv);
 skip_dm:
        /*  Check GPIO to determine current RF on/off and Pbc status. */
        /*  Check Hardware Radio ON/OFF or not */