staging: rtl8192e: Fix various problems noted by smatch
authorLarry Finger <Larry.Finger@lwfinger.net>
Thu, 1 Sep 2011 17:23:21 +0000 (12:23 -0500)
committerGreg Kroah-Hartman <gregkh@suse.de>
Tue, 6 Sep 2011 23:36:00 +0000 (16:36 -0700)
Smatch reports the following problems:

  CHECK   drivers/staging/rtl8192e/rtllib_softmac.c
drivers/staging/rtl8192e/rtllib_softmac.c +3143 rtllib_softmac_free(4) info: redundant null check on ieee->pDot11dInfo calling kfree()

  CHECK   drivers/staging/rtl8192e/rtllib_module.c
drivers/staging/rtl8192e/rtllib_module.c +198 free_rtllib(6) info: redundant null check on ieee->pHTInfo calling kfree()

  CHECK   drivers/staging/rtl8192e/rtl819x_TSProc.c
drivers/staging/rtl8192e/rtl819x_TSProc.c +280 SearchAdmitTRStream(52) error: potential null derefence 'pRet'.

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

index 5323a9c7bcad8e77ad12db51d5a4b23093650203..09a602f7432930bf85b3f5b300990d24c0d2badd 100644 (file)
@@ -277,7 +277,7 @@ static struct ts_common_info *SearchAdmitTRStream(struct rtllib_device *ieee,
                        break;
        }
 
-       if (&pRet->List  != psearch_list)
+       if (pRet && &pRet->List  != psearch_list)
                return pRet ;
        else
                return NULL;
index 0fe67a54edd257063f3af81611261fe5c857c78e..c36a140a4568534320dc65e8c1b895f82d29bdb8 100644 (file)
@@ -194,10 +194,9 @@ void free_rtllib(struct net_device *dev)
        struct rtllib_device *ieee = (struct rtllib_device *)
                                      netdev_priv_rsl(dev);
        int i;
-       if (ieee->pHTInfo != NULL) {
-               kfree(ieee->pHTInfo);
-               ieee->pHTInfo = NULL;
-       }
+
+       kfree(ieee->pHTInfo);
+       ieee->pHTInfo = NULL;
        rtllib_softmac_free(ieee);
        del_timer_sync(&ieee->crypt_deinit_timer);
        rtllib_crypt_deinit_entries(ieee, 1);
index a420ed1a9479994843cbba9c53b806897b288279..b5086850f0dee4ac5c05bccc7798013b0ff19e1f 100644 (file)
@@ -3139,10 +3139,8 @@ void rtllib_softmac_init(struct rtllib_device *ieee)
 void rtllib_softmac_free(struct rtllib_device *ieee)
 {
        down(&ieee->wx_sem);
-       if (NULL != ieee->pDot11dInfo) {
-               kfree(ieee->pDot11dInfo);
-               ieee->pDot11dInfo = NULL;
-       }
+       kfree(ieee->pDot11dInfo);
+       ieee->pDot11dInfo = NULL;
        del_timer_sync(&ieee->associate_timer);
 
        cancel_delayed_work(&ieee->associate_retry_wq);