Skip to content

Commit

Permalink
staging: rt2860: Remove NULL check before kfree
Browse files Browse the repository at this point in the history
This patch was generated by the following semantic patch:
// <smpl>
@@ expression E; @@
- if (E != NULL) { kfree(E); }
+ kfree(E);

@@ expression E; @@
- if (E != NULL) { kfree(E); E = NULL; }
+ kfree(E);
+ E = NULL;
// </smpl>

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
  • Loading branch information
Ilia Mirkin authored and Greg Kroah-Hartman committed Mar 14, 2011
1 parent 1491017 commit aea9d72
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
6 changes: 2 additions & 4 deletions drivers/staging/rt2860/common/spectrum.c
Original file line number Diff line number Diff line change
Expand Up @@ -416,8 +416,7 @@ void MeasureReqTabExit(struct rt_rtmp_adapter *pAd)
{
NdisFreeSpinLock(&pAd->CommonCfg.MeasureReqTabLock);

if (pAd->CommonCfg.pMeasureReqTab)
kfree(pAd->CommonCfg.pMeasureReqTab);
kfree(pAd->CommonCfg.pMeasureReqTab);
pAd->CommonCfg.pMeasureReqTab = NULL;

return;
Expand Down Expand Up @@ -614,8 +613,7 @@ void TpcReqTabExit(struct rt_rtmp_adapter *pAd)
{
NdisFreeSpinLock(&pAd->CommonCfg.TpcReqTabLock);

if (pAd->CommonCfg.pTpcReqTab)
kfree(pAd->CommonCfg.pTpcReqTab);
kfree(pAd->CommonCfg.pTpcReqTab);
pAd->CommonCfg.pTpcReqTab = NULL;

return;
Expand Down
6 changes: 2 additions & 4 deletions drivers/staging/rt2860/rt_linux.c
Original file line number Diff line number Diff line change
Expand Up @@ -241,8 +241,7 @@ void RTMPFreeAdapter(struct rt_rtmp_adapter *pAd)

os_cookie = (struct os_cookie *)pAd->OS_Cookie;

if (pAd->BeaconBuf)
kfree(pAd->BeaconBuf);
kfree(pAd->BeaconBuf);

NdisFreeSpinLock(&pAd->MgmtRingLock);

Expand All @@ -264,8 +263,7 @@ void RTMPFreeAdapter(struct rt_rtmp_adapter *pAd)
release_firmware(pAd->firmware);

vfree(pAd); /* pci_free_consistent(os_cookie->pci_dev,sizeof(struct rt_rtmp_adapter),pAd,os_cookie->pAd_pa); */
if (os_cookie)
kfree(os_cookie);
kfree(os_cookie);
}

BOOLEAN OS_Need_Clone_Packet(void)
Expand Down

0 comments on commit aea9d72

Please sign in to comment.