staging: rtl8188eu: os_dep: usb_intf.c: Fix to remove null pointer checks that could...
authorRickard Strandqvist <rickard_strandqvist@spectrumdigital.se>
Thu, 22 May 2014 19:58:02 +0000 (21:58 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 23 May 2014 16:50:54 +0000 (01:50 +0900)
Removal of null pointer checks that could never happen

Signed-off-by: Rickard Strandqvist <rickard_strandqvist@spectrumdigital.se>
Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Josh Triplett <josh@joshtriplett.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/rtl8188eu/os_dep/usb_intf.c

index ed9c6a1..246a420 100644 (file)
@@ -306,49 +306,47 @@ int rtw_hw_suspend(struct adapter *padapter)
                goto error_exit;
        }
 
-       if (padapter) { /* system suspend */
-               LeaveAllPowerSaveMode(padapter);
+       /* system suspend */
+       LeaveAllPowerSaveMode(padapter);
 
-               DBG_88E("==> rtw_hw_suspend\n");
-               _enter_pwrlock(&pwrpriv->lock);
-               pwrpriv->bips_processing = true;
-               /* s1. */
-               if (pnetdev) {
-                       netif_carrier_off(pnetdev);
-                       rtw_netif_stop_queue(pnetdev);
-               }
+       DBG_88E("==> rtw_hw_suspend\n");
+       _enter_pwrlock(&pwrpriv->lock);
+       pwrpriv->bips_processing = true;
+       /* s1. */
+       if (pnetdev) {
+               netif_carrier_off(pnetdev);
+               rtw_netif_stop_queue(pnetdev);
+       }
 
-               /* s2. */
-               rtw_disassoc_cmd(padapter, 500, false);
+       /* s2. */
+       rtw_disassoc_cmd(padapter, 500, false);
 
-               /* s2-2.  indicate disconnect to os */
-               {
-                       struct  mlme_priv *pmlmepriv = &padapter->mlmepriv;
+       /* s2-2.  indicate disconnect to os */
+       {
+               struct  mlme_priv *pmlmepriv = &padapter->mlmepriv;
 
-                       if (check_fwstate(pmlmepriv, _FW_LINKED)) {
-                               _clr_fwstate_(pmlmepriv, _FW_LINKED);
+               if (check_fwstate(pmlmepriv, _FW_LINKED)) {
+                       _clr_fwstate_(pmlmepriv, _FW_LINKED);
 
-                               rtw_led_control(padapter, LED_CTL_NO_LINK);
+                       rtw_led_control(padapter, LED_CTL_NO_LINK);
 
-                               rtw_os_indicate_disconnect(padapter);
+                       rtw_os_indicate_disconnect(padapter);
 
-                               /* donnot enqueue cmd */
-                               rtw_lps_ctrl_wk_cmd(padapter, LPS_CTRL_DISCONNECT, 0);
-                       }
+                       /* donnot enqueue cmd */
+                       rtw_lps_ctrl_wk_cmd(padapter, LPS_CTRL_DISCONNECT, 0);
                }
-               /* s2-3. */
-               rtw_free_assoc_resources(padapter, 1);
+       }
+       /* s2-3. */
+       rtw_free_assoc_resources(padapter, 1);
 
-               /* s2-4. */
-               rtw_free_network_queue(padapter, true);
-               rtw_ips_dev_unload(padapter);
-               pwrpriv->rf_pwrstate = rf_off;
-               pwrpriv->bips_processing = false;
+       /* s2-4. */
+       rtw_free_network_queue(padapter, true);
+       rtw_ips_dev_unload(padapter);
+       pwrpriv->rf_pwrstate = rf_off;
+       pwrpriv->bips_processing = false;
+
+       _exit_pwrlock(&pwrpriv->lock);
 
-               _exit_pwrlock(&pwrpriv->lock);
-       } else {
-               goto error_exit;
-       }
        return 0;
 
 error_exit:
@@ -362,35 +360,32 @@ int rtw_hw_resume(struct adapter *padapter)
        struct net_device *pnetdev = padapter->pnetdev;
 
 
-       if (padapter) { /* system resume */
-               DBG_88E("==> rtw_hw_resume\n");
-               _enter_pwrlock(&pwrpriv->lock);
-               pwrpriv->bips_processing = true;
-               rtw_reset_drv_sw(padapter);
+       /* system resume */
+       DBG_88E("==> rtw_hw_resume\n");
+       _enter_pwrlock(&pwrpriv->lock);
+       pwrpriv->bips_processing = true;
+       rtw_reset_drv_sw(padapter);
 
-               if (pm_netdev_open(pnetdev, false) != 0) {
-                       _exit_pwrlock(&pwrpriv->lock);
-                       goto error_exit;
-               }
+       if (pm_netdev_open(pnetdev, false) != 0) {
+               _exit_pwrlock(&pwrpriv->lock);
+               goto error_exit;
+       }
 
-               netif_device_attach(pnetdev);
-               netif_carrier_on(pnetdev);
+       netif_device_attach(pnetdev);
+       netif_carrier_on(pnetdev);
 
-               if (!netif_queue_stopped(pnetdev))
-                       netif_start_queue(pnetdev);
-               else
-                       netif_wake_queue(pnetdev);
+       if (!netif_queue_stopped(pnetdev))
+               netif_start_queue(pnetdev);
+       else
+               netif_wake_queue(pnetdev);
 
-               pwrpriv->bkeepfwalive = false;
-               pwrpriv->brfoffbyhw = false;
+       pwrpriv->bkeepfwalive = false;
+       pwrpriv->brfoffbyhw = false;
 
-               pwrpriv->rf_pwrstate = rf_on;
-               pwrpriv->bips_processing = false;
+       pwrpriv->rf_pwrstate = rf_on;
+       pwrpriv->bips_processing = false;
 
-               _exit_pwrlock(&pwrpriv->lock);
-       } else {
-               goto error_exit;
-       }
+       _exit_pwrlock(&pwrpriv->lock);
 
 
        return 0;
@@ -501,8 +496,7 @@ int rtw_resume_process(struct adapter *padapter)
 
        _enter_pwrlock(&pwrpriv->lock);
        rtw_reset_drv_sw(padapter);
-       if (pwrpriv)
-               pwrpriv->bkeepfwalive = false;
+       pwrpriv->bkeepfwalive = false;
 
        DBG_88E("bkeepfwalive(%x)\n", pwrpriv->bkeepfwalive);
        if (pm_netdev_open(pnetdev, true) != 0)