aboutsummaryrefslogtreecommitdiff
path: root/drivers/net
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/net
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/net')
-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 30f1d41a16d..c1d9902cac5 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)
/* Allocate and initialize cmdCtrlNode */
ulbufsize = sizeof(struct cmd_ctrl_node) * MRVDRV_NUM_OF_CMD_BUFFER;
- if (!(tempcmd_array = kmalloc(ulbufsize, GFP_KERNEL))) {
+ if (!(tempcmd_array = kzalloc(ulbufsize, GFP_KERNEL))) {
lbs_deb_cmd(
"ALLOC_CMD_BUF: failed to allocate tempcmd_array\n");
ret = -1;
goto done;
}
-
adapter->cmd_array = tempcmd_array;
- memset(adapter->cmd_array, 0, ulbufsize);
/* Allocate and initialize command buffers */
ulbufsize = MRVDRV_SIZE_OF_CMD_BUFFER;
for (i = 0; i < MRVDRV_NUM_OF_CMD_BUFFER; i++) {
- if (!(ptempvirtualaddr = kmalloc(ulbufsize, GFP_KERNEL))) {
+ if (!(ptempvirtualaddr = kzalloc(ulbufsize, GFP_KERNEL))) {
lbs_deb_cmd(
"ALLOC_CMD_BUF: ptempvirtualaddr: out of memory\n");
ret = -1;
goto done;
}
- memset(ptempvirtualaddr, 0, ulbufsize);
-
/* Update command buffer virtual */
tempcmd_array[i].bufvirtualaddr = ptempvirtualaddr;
}
diff --git a/drivers/net/wireless/libertas/fw.c b/drivers/net/wireless/libertas/fw.c
index 86c652dad92..2c965b5341d 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)
/* Allocate buffer to store the BSSID list */
ulbufsize = sizeof(struct bss_descriptor) * MRVDRV_MAX_BSSID_LIST;
- if (!(ptempscantable = kmalloc(ulbufsize, GFP_KERNEL))) {
+ if (!(ptempscantable = kzalloc(ulbufsize, GFP_KERNEL))) {
libertas_free_adapter(priv);
return -1;
}
-
adapter->scantable = ptempscantable;
- memset(adapter->scantable, 0, ulbufsize);
/* Allocate the command buffers */
libertas_allocate_cmd_buffer(priv);
diff --git a/drivers/net/wireless/libertas/main.c b/drivers/net/wireless/libertas/main.c
index f9369e50da3..8c4fceaa486 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)
lbs_pr_err("init ethX device failed\n");
return NULL;
}
-
priv = dev->priv;
/* allocate buffer for wlan_adapter */
- if (!(priv->adapter = kmalloc(sizeof(wlan_adapter), GFP_KERNEL))) {
+ if (!(priv->adapter = kzalloc(sizeof(wlan_adapter), GFP_KERNEL))) {
lbs_pr_err("allocate buffer for wlan_adapter failed\n");
- goto err_kmalloc;
+ goto err_kzalloc;
}
- /* init wlan_adapter */
- memset(priv->adapter, 0, sizeof(wlan_adapter));
-
priv->wlan_dev.netdev = dev;
priv->wlan_dev.card = card;
priv->mesh_open = 0;
@@ -802,14 +798,10 @@ wlan_private *wlan_add_card(void *card)
dev->stop = wlan_close;
dev->do_ioctl = libertas_do_ioctl;
dev->set_mac_address = wlan_set_mac_address;
-
-#define WLAN_WATCHDOG_TIMEOUT (5 * HZ)
-
dev->tx_timeout = wlan_tx_timeout;
dev->get_stats = wlan_get_stats;
- dev->watchdog_timeo = WLAN_WATCHDOG_TIMEOUT;
+ dev->watchdog_timeo = 5 * HZ;
dev->ethtool_ops = &libertas_ethtool_ops;
-
#ifdef WIRELESS_EXT
dev->wireless_handlers = (struct iw_handler_def *)&libertas_handler_def;
#endif
@@ -875,7 +867,7 @@ err_registerdev:
wake_up_interruptible(&priv->mainthread.waitq);
wlan_terminate_thread(&priv->mainthread);
kfree(priv->adapter);
-err_kmalloc:
+err_kzalloc:
free_netdev(dev);
lbs_deb_leave_args(LBS_DEB_NET, "priv NULL");