aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorHolger Schurig <hs4233@mail.mn-solutions.de>2007-05-25 11:58:22 -0400
committerJohn W. Linville <linville@tuxdriver.com>2007-06-11 14:28:38 -0400
commitfb3dddf22c63d7e0622d4819a87dbb8563f0e968 (patch)
treec2f87ff85be78a8501189b8ac555f61eb44f262a /drivers
parent6df3073d2923c12b6f7524917a634e83de958dfe (diff)
[PATCH] libertas: changed some occurences of kmalloc() + memset(&a,0,sz) to kzalloc()
The subject says it all. Signed-off-by: Holger Schurig <hs4233@mail.mn-solutions.de> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/wireless/libertas/cmd.c8
-rw-r--r--drivers/net/wireless/libertas/fw.c4
-rw-r--r--drivers/net/wireless/libertas/main.c16
3 files changed, 7 insertions, 21 deletions
diff --git a/drivers/net/wireless/libertas/cmd.c b/drivers/net/wireless/libertas/cmd.c
index 30f1d41a16d7..c1d9902cac5d 100644
--- a/drivers/net/wireless/libertas/cmd.c
+++ b/drivers/net/wireless/libertas/cmd.c
@@ -1482,28 +1482,24 @@ int libertas_allocate_cmd_buffer(wlan_private * priv)
1482 /* Allocate and initialize cmdCtrlNode */ 1482 /* Allocate and initialize cmdCtrlNode */
1483 ulbufsize = sizeof(struct cmd_ctrl_node) * MRVDRV_NUM_OF_CMD_BUFFER; 1483 ulbufsize = sizeof(struct cmd_ctrl_node) * MRVDRV_NUM_OF_CMD_BUFFER;
1484 1484
1485 if (!(tempcmd_array = kmalloc(ulbufsize, GFP_KERNEL))) { 1485 if (!(tempcmd_array = kzalloc(ulbufsize, GFP_KERNEL))) {
1486 lbs_deb_cmd( 1486 lbs_deb_cmd(
1487 "ALLOC_CMD_BUF: failed to allocate tempcmd_array\n"); 1487 "ALLOC_CMD_BUF: failed to allocate tempcmd_array\n");
1488 ret = -1; 1488 ret = -1;
1489 goto done; 1489 goto done;
1490 } 1490 }
1491
1492 adapter->cmd_array = tempcmd_array; 1491 adapter->cmd_array = tempcmd_array;
1493 memset(adapter->cmd_array, 0, ulbufsize);
1494 1492
1495 /* Allocate and initialize command buffers */ 1493 /* Allocate and initialize command buffers */
1496 ulbufsize = MRVDRV_SIZE_OF_CMD_BUFFER; 1494 ulbufsize = MRVDRV_SIZE_OF_CMD_BUFFER;
1497 for (i = 0; i < MRVDRV_NUM_OF_CMD_BUFFER; i++) { 1495 for (i = 0; i < MRVDRV_NUM_OF_CMD_BUFFER; i++) {
1498 if (!(ptempvirtualaddr = kmalloc(ulbufsize, GFP_KERNEL))) { 1496 if (!(ptempvirtualaddr = kzalloc(ulbufsize, GFP_KERNEL))) {
1499 lbs_deb_cmd( 1497 lbs_deb_cmd(
1500 "ALLOC_CMD_BUF: ptempvirtualaddr: out of memory\n"); 1498 "ALLOC_CMD_BUF: ptempvirtualaddr: out of memory\n");
1501 ret = -1; 1499 ret = -1;
1502 goto done; 1500 goto done;
1503 } 1501 }
1504 1502
1505 memset(ptempvirtualaddr, 0, ulbufsize);
1506
1507 /* Update command buffer virtual */ 1503 /* Update command buffer virtual */
1508 tempcmd_array[i].bufvirtualaddr = ptempvirtualaddr; 1504 tempcmd_array[i].bufvirtualaddr = ptempvirtualaddr;
1509 } 1505 }
diff --git a/drivers/net/wireless/libertas/fw.c b/drivers/net/wireless/libertas/fw.c
index 86c652dad92a..2c965b5341d4 100644
--- a/drivers/net/wireless/libertas/fw.c
+++ b/drivers/net/wireless/libertas/fw.c
@@ -139,13 +139,11 @@ static int wlan_allocate_adapter(wlan_private * priv)
139 139
140 /* Allocate buffer to store the BSSID list */ 140 /* Allocate buffer to store the BSSID list */
141 ulbufsize = sizeof(struct bss_descriptor) * MRVDRV_MAX_BSSID_LIST; 141 ulbufsize = sizeof(struct bss_descriptor) * MRVDRV_MAX_BSSID_LIST;
142 if (!(ptempscantable = kmalloc(ulbufsize, GFP_KERNEL))) { 142 if (!(ptempscantable = kzalloc(ulbufsize, GFP_KERNEL))) {
143 libertas_free_adapter(priv); 143 libertas_free_adapter(priv);
144 return -1; 144 return -1;
145 } 145 }
146
147 adapter->scantable = ptempscantable; 146 adapter->scantable = ptempscantable;
148 memset(adapter->scantable, 0, ulbufsize);
149 147
150 /* Allocate the command buffers */ 148 /* Allocate the command buffers */
151 libertas_allocate_cmd_buffer(priv); 149 libertas_allocate_cmd_buffer(priv);
diff --git a/drivers/net/wireless/libertas/main.c b/drivers/net/wireless/libertas/main.c
index f9369e50da3c..8c4fceaa486b 100644
--- a/drivers/net/wireless/libertas/main.c
+++ b/drivers/net/wireless/libertas/main.c
@@ -777,18 +777,14 @@ wlan_private *wlan_add_card(void *card)
777 lbs_pr_err("init ethX device failed\n"); 777 lbs_pr_err("init ethX device failed\n");
778 return NULL; 778 return NULL;
779 } 779 }
780
781 priv = dev->priv; 780 priv = dev->priv;
782 781
783 /* allocate buffer for wlan_adapter */ 782 /* allocate buffer for wlan_adapter */
784 if (!(priv->adapter = kmalloc(sizeof(wlan_adapter), GFP_KERNEL))) { 783 if (!(priv->adapter = kzalloc(sizeof(wlan_adapter), GFP_KERNEL))) {
785 lbs_pr_err("allocate buffer for wlan_adapter failed\n"); 784 lbs_pr_err("allocate buffer for wlan_adapter failed\n");
786 goto err_kmalloc; 785 goto err_kzalloc;
787 } 786 }
788 787
789 /* init wlan_adapter */
790 memset(priv->adapter, 0, sizeof(wlan_adapter));
791
792 priv->wlan_dev.netdev = dev; 788 priv->wlan_dev.netdev = dev;
793 priv->wlan_dev.card = card; 789 priv->wlan_dev.card = card;
794 priv->mesh_open = 0; 790 priv->mesh_open = 0;
@@ -802,14 +798,10 @@ wlan_private *wlan_add_card(void *card)
802 dev->stop = wlan_close; 798 dev->stop = wlan_close;
803 dev->do_ioctl = libertas_do_ioctl; 799 dev->do_ioctl = libertas_do_ioctl;
804 dev->set_mac_address = wlan_set_mac_address; 800 dev->set_mac_address = wlan_set_mac_address;
805
806#define WLAN_WATCHDOG_TIMEOUT (5 * HZ)
807
808 dev->tx_timeout = wlan_tx_timeout; 801 dev->tx_timeout = wlan_tx_timeout;
809 dev->get_stats = wlan_get_stats; 802 dev->get_stats = wlan_get_stats;
810 dev->watchdog_timeo = WLAN_WATCHDOG_TIMEOUT; 803 dev->watchdog_timeo = 5 * HZ;
811 dev->ethtool_ops = &libertas_ethtool_ops; 804 dev->ethtool_ops = &libertas_ethtool_ops;
812
813#ifdef WIRELESS_EXT 805#ifdef WIRELESS_EXT
814 dev->wireless_handlers = (struct iw_handler_def *)&libertas_handler_def; 806 dev->wireless_handlers = (struct iw_handler_def *)&libertas_handler_def;
815#endif 807#endif
@@ -875,7 +867,7 @@ err_registerdev:
875 wake_up_interruptible(&priv->mainthread.waitq); 867 wake_up_interruptible(&priv->mainthread.waitq);
876 wlan_terminate_thread(&priv->mainthread); 868 wlan_terminate_thread(&priv->mainthread);
877 kfree(priv->adapter); 869 kfree(priv->adapter);
878err_kmalloc: 870err_kzalloc:
879 free_netdev(dev); 871 free_netdev(dev);
880 872
881 lbs_deb_leave_args(LBS_DEB_NET, "priv NULL"); 873 lbs_deb_leave_args(LBS_DEB_NET, "priv NULL");