aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorYan Burman <burman.yan@gmail.com>2006-12-02 06:33:40 -0500
committerJohn W. Linville <linville@tuxdriver.com>2006-12-05 19:31:32 -0500
commitb0471bb7b779f5deea109e5bfdfe8c18d4a06241 (patch)
treed2fffb2916469c84b20a3e8e747cbf77d1a00e70 /drivers
parent9cdac9657fda58ae39c2bbc8be396f5530ed8398 (diff)
[PATCH] hostap: replace kmalloc+memset with kzalloc
Replace kmalloc+memset with kzalloc Signed-off-by: Yan Burman <burman.yan@gmail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/wireless/hostap/hostap_ap.c4
-rw-r--r--drivers/net/wireless/hostap/hostap_cs.c3
-rw-r--r--drivers/net/wireless/hostap/hostap_download.c4
-rw-r--r--drivers/net/wireless/hostap/hostap_hw.c12
-rw-r--r--drivers/net/wireless/hostap/hostap_info.c3
-rw-r--r--drivers/net/wireless/hostap/hostap_ioctl.c12
-rw-r--r--drivers/net/wireless/hostap/hostap_pci.c3
-rw-r--r--drivers/net/wireless/hostap/hostap_plx.c3
8 files changed, 12 insertions, 32 deletions
diff --git a/drivers/net/wireless/hostap/hostap_ap.c b/drivers/net/wireless/hostap/hostap_ap.c
index ba13125024cb..798a8555fbd7 100644
--- a/drivers/net/wireless/hostap/hostap_ap.c
+++ b/drivers/net/wireless/hostap/hostap_ap.c
@@ -1099,15 +1099,13 @@ static struct sta_info * ap_add_sta(struct ap_data *ap, u8 *addr)
1099{ 1099{
1100 struct sta_info *sta; 1100 struct sta_info *sta;
1101 1101
1102 sta = (struct sta_info *) 1102 sta = kzalloc(sizeof(struct sta_info), GFP_ATOMIC);
1103 kmalloc(sizeof(struct sta_info), GFP_ATOMIC);
1104 if (sta == NULL) { 1103 if (sta == NULL) {
1105 PDEBUG(DEBUG_AP, "AP: kmalloc failed\n"); 1104 PDEBUG(DEBUG_AP, "AP: kmalloc failed\n");
1106 return NULL; 1105 return NULL;
1107 } 1106 }
1108 1107
1109 /* initialize STA info data */ 1108 /* initialize STA info data */
1110 memset(sta, 0, sizeof(struct sta_info));
1111 sta->local = ap->local; 1109 sta->local = ap->local;
1112 skb_queue_head_init(&sta->tx_buf); 1110 skb_queue_head_init(&sta->tx_buf);
1113 memcpy(sta->addr, addr, ETH_ALEN); 1111 memcpy(sta->addr, addr, ETH_ALEN);
diff --git a/drivers/net/wireless/hostap/hostap_cs.c b/drivers/net/wireless/hostap/hostap_cs.c
index f63909e4bc32..ef470e6e1c2a 100644
--- a/drivers/net/wireless/hostap/hostap_cs.c
+++ b/drivers/net/wireless/hostap/hostap_cs.c
@@ -566,12 +566,11 @@ static int prism2_config(struct pcmcia_device *link)
566 PDEBUG(DEBUG_FLOW, "prism2_config()\n"); 566 PDEBUG(DEBUG_FLOW, "prism2_config()\n");
567 567
568 parse = kmalloc(sizeof(cisparse_t), GFP_KERNEL); 568 parse = kmalloc(sizeof(cisparse_t), GFP_KERNEL);
569 hw_priv = kmalloc(sizeof(*hw_priv), GFP_KERNEL); 569 hw_priv = kzalloc(sizeof(*hw_priv), GFP_KERNEL);
570 if (parse == NULL || hw_priv == NULL) { 570 if (parse == NULL || hw_priv == NULL) {
571 ret = -ENOMEM; 571 ret = -ENOMEM;
572 goto failed; 572 goto failed;
573 } 573 }
574 memset(hw_priv, 0, sizeof(*hw_priv));
575 574
576 tuple.DesiredTuple = CISTPL_CONFIG; 575 tuple.DesiredTuple = CISTPL_CONFIG;
577 tuple.Attributes = 0; 576 tuple.Attributes = 0;
diff --git a/drivers/net/wireless/hostap/hostap_download.c b/drivers/net/wireless/hostap/hostap_download.c
index ab26b52b3e76..24fc387bba67 100644
--- a/drivers/net/wireless/hostap/hostap_download.c
+++ b/drivers/net/wireless/hostap/hostap_download.c
@@ -685,14 +685,12 @@ static int prism2_download(local_info_t *local,
685 goto out; 685 goto out;
686 } 686 }
687 687
688 dl = kmalloc(sizeof(*dl) + param->num_areas * 688 dl = kzalloc(sizeof(*dl) + param->num_areas *
689 sizeof(struct prism2_download_data_area), GFP_KERNEL); 689 sizeof(struct prism2_download_data_area), GFP_KERNEL);
690 if (dl == NULL) { 690 if (dl == NULL) {
691 ret = -ENOMEM; 691 ret = -ENOMEM;
692 goto out; 692 goto out;
693 } 693 }
694 memset(dl, 0, sizeof(*dl) + param->num_areas *
695 sizeof(struct prism2_download_data_area));
696 dl->dl_cmd = param->dl_cmd; 694 dl->dl_cmd = param->dl_cmd;
697 dl->start_addr = param->start_addr; 695 dl->start_addr = param->start_addr;
698 dl->num_areas = param->num_areas; 696 dl->num_areas = param->num_areas;
diff --git a/drivers/net/wireless/hostap/hostap_hw.c b/drivers/net/wireless/hostap/hostap_hw.c
index ed00ebb6e7f4..9c503364ca3f 100644
--- a/drivers/net/wireless/hostap/hostap_hw.c
+++ b/drivers/net/wireless/hostap/hostap_hw.c
@@ -347,14 +347,12 @@ static int hfa384x_cmd(struct net_device *dev, u16 cmd, u16 param0,
347 if (signal_pending(current)) 347 if (signal_pending(current))
348 return -EINTR; 348 return -EINTR;
349 349
350 entry = (struct hostap_cmd_queue *) 350 entry = kzalloc(sizeof(*entry), GFP_ATOMIC);
351 kmalloc(sizeof(*entry), GFP_ATOMIC);
352 if (entry == NULL) { 351 if (entry == NULL) {
353 printk(KERN_DEBUG "%s: hfa384x_cmd - kmalloc failed\n", 352 printk(KERN_DEBUG "%s: hfa384x_cmd - kmalloc failed\n",
354 dev->name); 353 dev->name);
355 return -ENOMEM; 354 return -ENOMEM;
356 } 355 }
357 memset(entry, 0, sizeof(*entry));
358 atomic_set(&entry->usecnt, 1); 356 atomic_set(&entry->usecnt, 1);
359 entry->type = CMD_SLEEP; 357 entry->type = CMD_SLEEP;
360 entry->cmd = cmd; 358 entry->cmd = cmd;
@@ -517,14 +515,12 @@ static int hfa384x_cmd_callback(struct net_device *dev, u16 cmd, u16 param0,
517 return -1; 515 return -1;
518 } 516 }
519 517
520 entry = (struct hostap_cmd_queue *) 518 entry = kzalloc(sizeof(*entry), GFP_ATOMIC);
521 kmalloc(sizeof(*entry), GFP_ATOMIC);
522 if (entry == NULL) { 519 if (entry == NULL) {
523 printk(KERN_DEBUG "%s: hfa384x_cmd_callback - kmalloc " 520 printk(KERN_DEBUG "%s: hfa384x_cmd_callback - kmalloc "
524 "failed\n", dev->name); 521 "failed\n", dev->name);
525 return -ENOMEM; 522 return -ENOMEM;
526 } 523 }
527 memset(entry, 0, sizeof(*entry));
528 atomic_set(&entry->usecnt, 1); 524 atomic_set(&entry->usecnt, 1);
529 entry->type = CMD_CALLBACK; 525 entry->type = CMD_CALLBACK;
530 entry->cmd = cmd; 526 entry->cmd = cmd;
@@ -3015,14 +3011,12 @@ static int prism2_set_tim(struct net_device *dev, int aid, int set)
3015 iface = netdev_priv(dev); 3011 iface = netdev_priv(dev);
3016 local = iface->local; 3012 local = iface->local;
3017 3013
3018 new_entry = (struct set_tim_data *) 3014 new_entry = kzalloc(sizeof(*new_entry), GFP_ATOMIC);
3019 kmalloc(sizeof(*new_entry), GFP_ATOMIC);
3020 if (new_entry == NULL) { 3015 if (new_entry == NULL) {
3021 printk(KERN_DEBUG "%s: prism2_set_tim: kmalloc failed\n", 3016 printk(KERN_DEBUG "%s: prism2_set_tim: kmalloc failed\n",
3022 local->dev->name); 3017 local->dev->name);
3023 return -ENOMEM; 3018 return -ENOMEM;
3024 } 3019 }
3025 memset(new_entry, 0, sizeof(*new_entry));
3026 new_entry->aid = aid; 3020 new_entry->aid = aid;
3027 new_entry->set = set; 3021 new_entry->set = set;
3028 3022
diff --git a/drivers/net/wireless/hostap/hostap_info.c b/drivers/net/wireless/hostap/hostap_info.c
index 50f72d831cf4..00ed6389076b 100644
--- a/drivers/net/wireless/hostap/hostap_info.c
+++ b/drivers/net/wireless/hostap/hostap_info.c
@@ -327,11 +327,10 @@ static void prism2_info_hostscanresults(local_info_t *local,
327 ptr = (u8 *) pos; 327 ptr = (u8 *) pos;
328 328
329 new_count = left / result_size; 329 new_count = left / result_size;
330 results = kmalloc(new_count * sizeof(struct hfa384x_hostscan_result), 330 results = kcalloc(new_count, sizeof(struct hfa384x_hostscan_result),
331 GFP_ATOMIC); 331 GFP_ATOMIC);
332 if (results == NULL) 332 if (results == NULL)
333 return; 333 return;
334 memset(results, 0, new_count * sizeof(struct hfa384x_hostscan_result));
335 334
336 for (i = 0; i < new_count; i++) { 335 for (i = 0; i < new_count; i++) {
337 memcpy(&results[i], ptr, copy_len); 336 memcpy(&results[i], ptr, copy_len);
diff --git a/drivers/net/wireless/hostap/hostap_ioctl.c b/drivers/net/wireless/hostap/hostap_ioctl.c
index d061fb3443ff..3b7b8063ff1c 100644
--- a/drivers/net/wireless/hostap/hostap_ioctl.c
+++ b/drivers/net/wireless/hostap/hostap_ioctl.c
@@ -181,12 +181,10 @@ static int prism2_ioctl_siwencode(struct net_device *dev,
181 struct ieee80211_crypt_data *new_crypt; 181 struct ieee80211_crypt_data *new_crypt;
182 182
183 /* take WEP into use */ 183 /* take WEP into use */
184 new_crypt = (struct ieee80211_crypt_data *) 184 new_crypt = kzalloc(sizeof(struct ieee80211_crypt_data),
185 kmalloc(sizeof(struct ieee80211_crypt_data),
186 GFP_KERNEL); 185 GFP_KERNEL);
187 if (new_crypt == NULL) 186 if (new_crypt == NULL)
188 return -ENOMEM; 187 return -ENOMEM;
189 memset(new_crypt, 0, sizeof(struct ieee80211_crypt_data));
190 new_crypt->ops = ieee80211_get_crypto_ops("WEP"); 188 new_crypt->ops = ieee80211_get_crypto_ops("WEP");
191 if (!new_crypt->ops) { 189 if (!new_crypt->ops) {
192 request_module("ieee80211_crypt_wep"); 190 request_module("ieee80211_crypt_wep");
@@ -3320,14 +3318,12 @@ static int prism2_ioctl_siwencodeext(struct net_device *dev,
3320 3318
3321 prism2_crypt_delayed_deinit(local, crypt); 3319 prism2_crypt_delayed_deinit(local, crypt);
3322 3320
3323 new_crypt = (struct ieee80211_crypt_data *) 3321 new_crypt = kzalloc(sizeof(struct ieee80211_crypt_data),
3324 kmalloc(sizeof(struct ieee80211_crypt_data),
3325 GFP_KERNEL); 3322 GFP_KERNEL);
3326 if (new_crypt == NULL) { 3323 if (new_crypt == NULL) {
3327 ret = -ENOMEM; 3324 ret = -ENOMEM;
3328 goto done; 3325 goto done;
3329 } 3326 }
3330 memset(new_crypt, 0, sizeof(struct ieee80211_crypt_data));
3331 new_crypt->ops = ops; 3327 new_crypt->ops = ops;
3332 new_crypt->priv = new_crypt->ops->init(i); 3328 new_crypt->priv = new_crypt->ops->init(i);
3333 if (new_crypt->priv == NULL) { 3329 if (new_crypt->priv == NULL) {
@@ -3538,14 +3534,12 @@ static int prism2_ioctl_set_encryption(local_info_t *local,
3538 3534
3539 prism2_crypt_delayed_deinit(local, crypt); 3535 prism2_crypt_delayed_deinit(local, crypt);
3540 3536
3541 new_crypt = (struct ieee80211_crypt_data *) 3537 new_crypt = kzalloc(sizeof(struct ieee80211_crypt_data),
3542 kmalloc(sizeof(struct ieee80211_crypt_data),
3543 GFP_KERNEL); 3538 GFP_KERNEL);
3544 if (new_crypt == NULL) { 3539 if (new_crypt == NULL) {
3545 ret = -ENOMEM; 3540 ret = -ENOMEM;
3546 goto done; 3541 goto done;
3547 } 3542 }
3548 memset(new_crypt, 0, sizeof(struct ieee80211_crypt_data));
3549 new_crypt->ops = ops; 3543 new_crypt->ops = ops;
3550 new_crypt->priv = new_crypt->ops->init(param->u.crypt.idx); 3544 new_crypt->priv = new_crypt->ops->init(param->u.crypt.idx);
3551 if (new_crypt->priv == NULL) { 3545 if (new_crypt->priv == NULL) {
diff --git a/drivers/net/wireless/hostap/hostap_pci.c b/drivers/net/wireless/hostap/hostap_pci.c
index d1de9766c831..c4f6020baa9e 100644
--- a/drivers/net/wireless/hostap/hostap_pci.c
+++ b/drivers/net/wireless/hostap/hostap_pci.c
@@ -300,10 +300,9 @@ static int prism2_pci_probe(struct pci_dev *pdev,
300 struct hostap_interface *iface; 300 struct hostap_interface *iface;
301 struct hostap_pci_priv *hw_priv; 301 struct hostap_pci_priv *hw_priv;
302 302
303 hw_priv = kmalloc(sizeof(*hw_priv), GFP_KERNEL); 303 hw_priv = kzalloc(sizeof(*hw_priv), GFP_KERNEL);
304 if (hw_priv == NULL) 304 if (hw_priv == NULL)
305 return -ENOMEM; 305 return -ENOMEM;
306 memset(hw_priv, 0, sizeof(*hw_priv));
307 306
308 if (pci_enable_device(pdev)) 307 if (pci_enable_device(pdev))
309 goto err_out_free; 308 goto err_out_free;
diff --git a/drivers/net/wireless/hostap/hostap_plx.c b/drivers/net/wireless/hostap/hostap_plx.c
index bc81b13a5a2a..e235e0647897 100644
--- a/drivers/net/wireless/hostap/hostap_plx.c
+++ b/drivers/net/wireless/hostap/hostap_plx.c
@@ -447,10 +447,9 @@ static int prism2_plx_probe(struct pci_dev *pdev,
447 int tmd7160; 447 int tmd7160;
448 struct hostap_plx_priv *hw_priv; 448 struct hostap_plx_priv *hw_priv;
449 449
450 hw_priv = kmalloc(sizeof(*hw_priv), GFP_KERNEL); 450 hw_priv = kzalloc(sizeof(*hw_priv), GFP_KERNEL);
451 if (hw_priv == NULL) 451 if (hw_priv == NULL)
452 return -ENOMEM; 452 return -ENOMEM;
453 memset(hw_priv, 0, sizeof(*hw_priv));
454 453
455 if (pci_enable_device(pdev)) 454 if (pci_enable_device(pdev))
456 goto err_out_free; 455 goto err_out_free;