Skip to content

Commit

Permalink
Staging: wlan-ng: Remove unnecessary checks for NULL before calling k…
Browse files Browse the repository at this point in the history
…free()

Signed-off-by: Moritz Muehlenhoff <jmm@debian.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
  • Loading branch information
Moritz Muehlenhoff authored and Greg Kroah-Hartman committed Apr 3, 2009
1 parent e469ee7 commit 7c98f71
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 10 deletions.
9 changes: 3 additions & 6 deletions drivers/staging/wlan-ng/prism2sta.c
Original file line number Diff line number Diff line change
Expand Up @@ -1134,8 +1134,7 @@ static void prism2sta_inf_hostscanresults(wlandevice_t *wlandev,
if (nbss > 32)
nbss = 32;

if (hw->scanresults)
kfree(hw->scanresults);
kfree(hw->scanresults);

hw->scanresults = kmalloc(sizeof(hfa384x_InfFrame_t), GFP_ATOMIC);
memcpy(hw->scanresults, inf, sizeof(hfa384x_InfFrame_t));
Expand Down Expand Up @@ -1966,10 +1965,8 @@ static wlandevice_t *create_wlan(void)

if (!wlandev || !hw) {
printk(KERN_ERR "%s: Memory allocation failure.\n", dev_info);
if (wlandev)
kfree(wlandev);
if (hw)
kfree(hw);
kfree(wlandev);
kfree(hw);
return NULL;
}

Expand Down
6 changes: 2 additions & 4 deletions drivers/staging/wlan-ng/prism2usb.c
Original file line number Diff line number Diff line change
Expand Up @@ -165,10 +165,8 @@ static int prism2sta_probe_usb(struct usb_interface *interface,
goto done;

failed:
if (wlandev)
kfree(wlandev);
if (hw)
kfree(hw);
kfree(wlandev);
kfree(hw);
wlandev = NULL;

done:
Expand Down

0 comments on commit 7c98f71

Please sign in to comment.