From 7c98f718786c3c6d03ee377b62838fff3cc8f573 Mon Sep 17 00:00:00 2001 From: Moritz Muehlenhoff Date: Mon, 9 Feb 2009 19:33:42 +0100 Subject: [PATCH] Staging: wlan-ng: Remove unnecessary checks for NULL before calling kfree() Signed-off-by: Moritz Muehlenhoff Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wlan-ng/prism2sta.c | 9 +++------ drivers/staging/wlan-ng/prism2usb.c | 6 ++---- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/drivers/staging/wlan-ng/prism2sta.c b/drivers/staging/wlan-ng/prism2sta.c index d720934be793..c3ab31ef703a 100644 --- a/drivers/staging/wlan-ng/prism2sta.c +++ b/drivers/staging/wlan-ng/prism2sta.c @@ -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)); @@ -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; } diff --git a/drivers/staging/wlan-ng/prism2usb.c b/drivers/staging/wlan-ng/prism2usb.c index 0bb4e7833060..252312e79581 100644 --- a/drivers/staging/wlan-ng/prism2usb.c +++ b/drivers/staging/wlan-ng/prism2usb.c @@ -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: -- 2.30.2