staging: rtl8192e: Fix smatch error in r8192E_phy.c
authorLarry Finger <Larry.Finger@lwfinger.net>
Thu, 1 Sep 2011 17:23:19 +0000 (12:23 -0500)
committerGreg Kroah-Hartman <gregkh@suse.de>
Tue, 6 Sep 2011 23:35:59 +0000 (16:35 -0700)
Smatch reports the following:

  CHECK   drivers/staging/rtl8192e/r8192E_phy.c
drivers/staging/rtl8192e/r8192E_phy.c +940 rtl8192_phy_SwChnlStepByStep(92) error: potential null derefence 'CurrentCmd'.

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/staging/rtl8192e/r8192E_phy.c

index 83e00d72199a5f8bebc8fb4085106a71840daa92..7ec6139cb4fb01f84e3952aa3ec2b3c80e6b1d8e 100644 (file)
@@ -937,7 +937,7 @@ static u8 rtl8192_phy_SwChnlStepByStep(struct net_device *dev, u8 channel,
                                break;
                        }
 
-                       if (CurrentCmd->CmdID == CmdID_End) {
+                       if (CurrentCmd && CurrentCmd->CmdID == CmdID_End) {
                                if ((*stage) == 2) {
                                        return true;
                                } else {
@@ -947,6 +947,8 @@ static u8 rtl8192_phy_SwChnlStepByStep(struct net_device *dev, u8 channel,
                                }
                        }
 
+                       if (!CurrentCmd)
+                               continue;
                        switch (CurrentCmd->CmdID) {
                        case CmdID_SetTxPowerLevel:
                                if (priv->IC_Cut > (u8)VERSION_8190_BD)