Skip to content

Commit

Permalink
staging/wlan-ng: use kzalloc rather using kmalloc at create_wlan
Browse files Browse the repository at this point in the history
instead we would have used kzalloc, so our memory which is allocated will be set to 0.

codepath:

the code path here is prism2sta_probe_usb, calling when ever usb-dev id
and usb-vendor id e.t.c matches with what ever present in the MODULE_DEVICE_TABLE,

and in prism2sta_probe_usb , we call create_wlan, and its called nowhere else...

Signed-off-by: Devendra Naga <devendra.aaru@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Devendra Naga authored and Greg Kroah-Hartman committed Jul 17, 2012
1 parent 6594ac5 commit 1a46eaf
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions drivers/staging/wlan-ng/prism2sta.c
Original file line number Diff line number Diff line change
Expand Up @@ -1947,8 +1947,8 @@ static wlandevice_t *create_wlan(void)
hfa384x_t *hw = NULL;

/* Alloc our structures */
wlandev = kmalloc(sizeof(wlandevice_t), GFP_KERNEL);
hw = kmalloc(sizeof(hfa384x_t), GFP_KERNEL);
wlandev = kzalloc(sizeof(wlandevice_t), GFP_KERNEL);
hw = kzalloc(sizeof(hfa384x_t), GFP_KERNEL);

if (!wlandev || !hw) {
printk(KERN_ERR "%s: Memory allocation failure.\n", dev_info);
Expand All @@ -1957,10 +1957,6 @@ static wlandevice_t *create_wlan(void)
return NULL;
}

/* Clear all the structs */
memset(wlandev, 0, sizeof(wlandevice_t));
memset(hw, 0, sizeof(hfa384x_t));

/* Initialize the network device object. */
wlandev->nsdname = dev_info;
wlandev->msdstate = WLAN_MSD_HWPRESENT_PENDING;
Expand Down

0 comments on commit 1a46eaf

Please sign in to comment.