aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorJoe Perches <joe@perches.com>2013-02-03 12:28:14 -0500
committerDavid S. Miller <davem@davemloft.net>2013-02-04 13:22:34 -0500
commit0d2e7a5c608063f72048899d20505c2ee130566c (patch)
tree4eae4acaf7c04bb60337389aaef8065c00b1737a /drivers
parent9d11bd1592fba0b9231d3ce8ab61977db7e03e27 (diff)
wireless: Remove unnecessary alloc/OOM messages, alloc cleanups
alloc failures already get standardized OOM messages and a dump_stack. Convert kzalloc's with multiplies to kcalloc. Convert kmalloc's with multiplies to kmalloc_array. Remove now unused variables. Remove unnecessary memset after kzalloc->kcalloc. Whitespace cleanups for these changes. Signed-off-by: Joe Perches <joe@perches.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/wireless/airo_cs.c5
-rw-r--r--drivers/net/wireless/at76c50x-usb.c4
-rw-r--r--drivers/net/wireless/ath/ath9k/dfs_pattern_detector.c6
-rw-r--r--drivers/net/wireless/atmel_cs.c5
-rw-r--r--drivers/net/wireless/ipw2x00/ipw2100.c9
-rw-r--r--drivers/net/wireless/libertas/cfg.c4
-rw-r--r--drivers/net/wireless/mwifiex/11n.c5
-rw-r--r--drivers/net/wireless/mwifiex/11n_rxreorder.c5
-rw-r--r--drivers/net/wireless/mwifiex/cfg80211.c4
-rw-r--r--drivers/net/wireless/mwifiex/cmdevt.c11
-rw-r--r--drivers/net/wireless/mwifiex/init.c5
-rw-r--r--drivers/net/wireless/mwifiex/scan.c27
-rw-r--r--drivers/net/wireless/mwifiex/sdio.c11
-rw-r--r--drivers/net/wireless/mwifiex/sta_ioctl.c11
-rw-r--r--drivers/net/wireless/mwifiex/wmm.c7
-rw-r--r--drivers/net/wireless/orinoco/main.c16
-rw-r--r--drivers/net/wireless/p54/p54usb.c10
-rw-r--r--drivers/net/wireless/prism54/islpci_mgt.c14
-rw-r--r--drivers/net/wireless/rndis_wlan.c5
-rw-r--r--drivers/net/wireless/ti/wlcore/sdio.c4
-rw-r--r--drivers/net/wireless/ti/wlcore/spi.c14
-rw-r--r--drivers/net/wireless/zd1211rw/zd_usb.c1
22 files changed, 50 insertions, 133 deletions
diff --git a/drivers/net/wireless/airo_cs.c b/drivers/net/wireless/airo_cs.c
index 630577dd3a7a..956024a636e6 100644
--- a/drivers/net/wireless/airo_cs.c
+++ b/drivers/net/wireless/airo_cs.c
@@ -69,10 +69,9 @@ static int airo_probe(struct pcmcia_device *p_dev)
69 69
70 /* Allocate space for private device-specific data */ 70 /* Allocate space for private device-specific data */
71 local = kzalloc(sizeof(local_info_t), GFP_KERNEL); 71 local = kzalloc(sizeof(local_info_t), GFP_KERNEL);
72 if (!local) { 72 if (!local)
73 printk(KERN_ERR "airo_cs: no memory for new device\n");
74 return -ENOMEM; 73 return -ENOMEM;
75 } 74
76 p_dev->priv = local; 75 p_dev->priv = local;
77 76
78 return airo_config(p_dev); 77 return airo_config(p_dev);
diff --git a/drivers/net/wireless/at76c50x-usb.c b/drivers/net/wireless/at76c50x-usb.c
index 77fa4286e5e9..5ac5f7ae2721 100644
--- a/drivers/net/wireless/at76c50x-usb.c
+++ b/drivers/net/wireless/at76c50x-usb.c
@@ -2164,10 +2164,8 @@ static int at76_alloc_urbs(struct at76_priv *priv,
2164 2164
2165 buffer_size = sizeof(struct at76_tx_buffer) + MAX_PADDING_SIZE; 2165 buffer_size = sizeof(struct at76_tx_buffer) + MAX_PADDING_SIZE;
2166 priv->bulk_out_buffer = kmalloc(buffer_size, GFP_KERNEL); 2166 priv->bulk_out_buffer = kmalloc(buffer_size, GFP_KERNEL);
2167 if (!priv->bulk_out_buffer) { 2167 if (!priv->bulk_out_buffer)
2168 dev_err(&interface->dev, "cannot allocate output buffer\n");
2169 return -ENOMEM; 2168 return -ENOMEM;
2170 }
2171 2169
2172 at76_dbg(DBG_PROC_ENTRY, "%s: EXIT", __func__); 2170 at76_dbg(DBG_PROC_ENTRY, "%s: EXIT", __func__);
2173 2171
diff --git a/drivers/net/wireless/ath/ath9k/dfs_pattern_detector.c b/drivers/net/wireless/ath/ath9k/dfs_pattern_detector.c
index 24877b00cbf4..467b60014b7b 100644
--- a/drivers/net/wireless/ath/ath9k/dfs_pattern_detector.c
+++ b/drivers/net/wireless/ath/ath9k/dfs_pattern_detector.c
@@ -288,11 +288,11 @@ struct dfs_pattern_detector *
288dfs_pattern_detector_init(enum nl80211_dfs_regions region) 288dfs_pattern_detector_init(enum nl80211_dfs_regions region)
289{ 289{
290 struct dfs_pattern_detector *dpd; 290 struct dfs_pattern_detector *dpd;
291
291 dpd = kmalloc(sizeof(*dpd), GFP_KERNEL); 292 dpd = kmalloc(sizeof(*dpd), GFP_KERNEL);
292 if (dpd == NULL) { 293 if (dpd == NULL)
293 pr_err("allocation of dfs_pattern_detector failed\n");
294 return NULL; 294 return NULL;
295 } 295
296 *dpd = default_dpd; 296 *dpd = default_dpd;
297 INIT_LIST_HEAD(&dpd->channel_detectors); 297 INIT_LIST_HEAD(&dpd->channel_detectors);
298 298
diff --git a/drivers/net/wireless/atmel_cs.c b/drivers/net/wireless/atmel_cs.c
index ded03d226a71..b42930f457c2 100644
--- a/drivers/net/wireless/atmel_cs.c
+++ b/drivers/net/wireless/atmel_cs.c
@@ -79,10 +79,9 @@ static int atmel_probe(struct pcmcia_device *p_dev)
79 79
80 /* Allocate space for private device-specific data */ 80 /* Allocate space for private device-specific data */
81 local = kzalloc(sizeof(local_info_t), GFP_KERNEL); 81 local = kzalloc(sizeof(local_info_t), GFP_KERNEL);
82 if (!local) { 82 if (!local)
83 printk(KERN_ERR "atmel_cs: no memory for new device\n");
84 return -ENOMEM; 83 return -ENOMEM;
85 } 84
86 p_dev->priv = local; 85 p_dev->priv = local;
87 86
88 return atmel_config(p_dev); 87 return atmel_config(p_dev);
diff --git a/drivers/net/wireless/ipw2x00/ipw2100.c b/drivers/net/wireless/ipw2x00/ipw2100.c
index d92b21a8e597..04d5e6442bf6 100644
--- a/drivers/net/wireless/ipw2x00/ipw2100.c
+++ b/drivers/net/wireless/ipw2x00/ipw2100.c
@@ -4478,13 +4478,10 @@ static int ipw2100_tx_allocate(struct ipw2100_priv *priv)
4478 return err; 4478 return err;
4479 } 4479 }
4480 4480
4481 priv->tx_buffers = 4481 priv->tx_buffers = kmalloc_array(TX_PENDED_QUEUE_LENGTH,
4482 kmalloc(TX_PENDED_QUEUE_LENGTH * sizeof(struct ipw2100_tx_packet), 4482 sizeof(struct ipw2100_tx_packet),
4483 GFP_ATOMIC); 4483 GFP_ATOMIC);
4484 if (!priv->tx_buffers) { 4484 if (!priv->tx_buffers) {
4485 printk(KERN_ERR DRV_NAME
4486 ": %s: alloc failed form tx buffers.\n",
4487 priv->net_dev->name);
4488 bd_queue_free(priv, &priv->tx_queue); 4485 bd_queue_free(priv, &priv->tx_queue);
4489 return -ENOMEM; 4486 return -ENOMEM;
4490 } 4487 }
diff --git a/drivers/net/wireless/libertas/cfg.c b/drivers/net/wireless/libertas/cfg.c
index 230f8ebbe289..a7dcb2e5eccc 100644
--- a/drivers/net/wireless/libertas/cfg.c
+++ b/drivers/net/wireless/libertas/cfg.c
@@ -2081,10 +2081,8 @@ struct wireless_dev *lbs_cfg_alloc(struct device *dev)
2081 lbs_deb_enter(LBS_DEB_CFG80211); 2081 lbs_deb_enter(LBS_DEB_CFG80211);
2082 2082
2083 wdev = kzalloc(sizeof(struct wireless_dev), GFP_KERNEL); 2083 wdev = kzalloc(sizeof(struct wireless_dev), GFP_KERNEL);
2084 if (!wdev) { 2084 if (!wdev)
2085 dev_err(dev, "cannot allocate wireless device\n");
2086 return ERR_PTR(-ENOMEM); 2085 return ERR_PTR(-ENOMEM);
2087 }
2088 2086
2089 wdev->wiphy = wiphy_new(&lbs_cfg80211_ops, sizeof(struct lbs_private)); 2087 wdev->wiphy = wiphy_new(&lbs_cfg80211_ops, sizeof(struct lbs_private));
2090 if (!wdev->wiphy) { 2088 if (!wdev->wiphy) {
diff --git a/drivers/net/wireless/mwifiex/11n.c b/drivers/net/wireless/mwifiex/11n.c
index 9cd6216c61e6..7b0ae2407083 100644
--- a/drivers/net/wireless/mwifiex/11n.c
+++ b/drivers/net/wireless/mwifiex/11n.c
@@ -533,11 +533,8 @@ void mwifiex_create_ba_tbl(struct mwifiex_private *priv, u8 *ra, int tid,
533 if (!mwifiex_get_ba_tbl(priv, tid, ra)) { 533 if (!mwifiex_get_ba_tbl(priv, tid, ra)) {
534 new_node = kzalloc(sizeof(struct mwifiex_tx_ba_stream_tbl), 534 new_node = kzalloc(sizeof(struct mwifiex_tx_ba_stream_tbl),
535 GFP_ATOMIC); 535 GFP_ATOMIC);
536 if (!new_node) { 536 if (!new_node)
537 dev_err(priv->adapter->dev,
538 "%s: failed to alloc new_node\n", __func__);
539 return; 537 return;
540 }
541 538
542 INIT_LIST_HEAD(&new_node->list); 539 INIT_LIST_HEAD(&new_node->list);
543 540
diff --git a/drivers/net/wireless/mwifiex/11n_rxreorder.c b/drivers/net/wireless/mwifiex/11n_rxreorder.c
index 4a97acd170f7..5e796f847088 100644
--- a/drivers/net/wireless/mwifiex/11n_rxreorder.c
+++ b/drivers/net/wireless/mwifiex/11n_rxreorder.c
@@ -272,11 +272,8 @@ mwifiex_11n_create_rx_reorder_tbl(struct mwifiex_private *priv, u8 *ta,
272 } 272 }
273 /* if !tbl then create one */ 273 /* if !tbl then create one */
274 new_node = kzalloc(sizeof(struct mwifiex_rx_reorder_tbl), GFP_KERNEL); 274 new_node = kzalloc(sizeof(struct mwifiex_rx_reorder_tbl), GFP_KERNEL);
275 if (!new_node) { 275 if (!new_node)
276 dev_err(priv->adapter->dev, "%s: failed to alloc new_node\n",
277 __func__);
278 return; 276 return;
279 }
280 277
281 INIT_LIST_HEAD(&new_node->list); 278 INIT_LIST_HEAD(&new_node->list);
282 new_node->tid = tid; 279 new_node->tid = tid;
diff --git a/drivers/net/wireless/mwifiex/cfg80211.c b/drivers/net/wireless/mwifiex/cfg80211.c
index ab92e799cf75..8ba48192cd2f 100644
--- a/drivers/net/wireless/mwifiex/cfg80211.c
+++ b/drivers/net/wireless/mwifiex/cfg80211.c
@@ -1820,10 +1820,8 @@ mwifiex_cfg80211_scan(struct wiphy *wiphy,
1820 1820
1821 priv->user_scan_cfg = kzalloc(sizeof(struct mwifiex_user_scan_cfg), 1821 priv->user_scan_cfg = kzalloc(sizeof(struct mwifiex_user_scan_cfg),
1822 GFP_KERNEL); 1822 GFP_KERNEL);
1823 if (!priv->user_scan_cfg) { 1823 if (!priv->user_scan_cfg)
1824 dev_err(priv->adapter->dev, "failed to alloc scan_req\n");
1825 return -ENOMEM; 1824 return -ENOMEM;
1826 }
1827 1825
1828 priv->scan_request = request; 1826 priv->scan_request = request;
1829 1827
diff --git a/drivers/net/wireless/mwifiex/cmdevt.c b/drivers/net/wireless/mwifiex/cmdevt.c
index 5f438e6c2155..2b125beecf2c 100644
--- a/drivers/net/wireless/mwifiex/cmdevt.c
+++ b/drivers/net/wireless/mwifiex/cmdevt.c
@@ -334,20 +334,15 @@ static int mwifiex_dnld_sleep_confirm_cmd(struct mwifiex_adapter *adapter)
334int mwifiex_alloc_cmd_buffer(struct mwifiex_adapter *adapter) 334int mwifiex_alloc_cmd_buffer(struct mwifiex_adapter *adapter)
335{ 335{
336 struct cmd_ctrl_node *cmd_array; 336 struct cmd_ctrl_node *cmd_array;
337 u32 buf_size;
338 u32 i; 337 u32 i;
339 338
340 /* Allocate and initialize struct cmd_ctrl_node */ 339 /* Allocate and initialize struct cmd_ctrl_node */
341 buf_size = sizeof(struct cmd_ctrl_node) * MWIFIEX_NUM_OF_CMD_BUFFER; 340 cmd_array = kcalloc(MWIFIEX_NUM_OF_CMD_BUFFER,
342 cmd_array = kzalloc(buf_size, GFP_KERNEL); 341 sizeof(struct cmd_ctrl_node), GFP_KERNEL);
343 if (!cmd_array) { 342 if (!cmd_array)
344 dev_err(adapter->dev, "%s: failed to alloc cmd_array\n",
345 __func__);
346 return -ENOMEM; 343 return -ENOMEM;
347 }
348 344
349 adapter->cmd_pool = cmd_array; 345 adapter->cmd_pool = cmd_array;
350 memset(adapter->cmd_pool, 0, buf_size);
351 346
352 /* Allocate and initialize command buffers */ 347 /* Allocate and initialize command buffers */
353 for (i = 0; i < MWIFIEX_NUM_OF_CMD_BUFFER; i++) { 348 for (i = 0; i < MWIFIEX_NUM_OF_CMD_BUFFER; i++) {
diff --git a/drivers/net/wireless/mwifiex/init.c b/drivers/net/wireless/mwifiex/init.c
index e00b8060aff7..84848c33b7f0 100644
--- a/drivers/net/wireless/mwifiex/init.c
+++ b/drivers/net/wireless/mwifiex/init.c
@@ -39,11 +39,8 @@ static int mwifiex_add_bss_prio_tbl(struct mwifiex_private *priv)
39 unsigned long flags; 39 unsigned long flags;
40 40
41 bss_prio = kzalloc(sizeof(struct mwifiex_bss_prio_node), GFP_KERNEL); 41 bss_prio = kzalloc(sizeof(struct mwifiex_bss_prio_node), GFP_KERNEL);
42 if (!bss_prio) { 42 if (!bss_prio)
43 dev_err(adapter->dev, "%s: failed to alloc bss_prio\n",
44 __func__);
45 return -ENOMEM; 43 return -ENOMEM;
46 }
47 44
48 bss_prio->priv = priv; 45 bss_prio->priv = priv;
49 INIT_LIST_HEAD(&bss_prio->list); 46 INIT_LIST_HEAD(&bss_prio->list);
diff --git a/drivers/net/wireless/mwifiex/scan.c b/drivers/net/wireless/mwifiex/scan.c
index 9189a32b7844..f0de40166dc3 100644
--- a/drivers/net/wireless/mwifiex/scan.c
+++ b/drivers/net/wireless/mwifiex/scan.c
@@ -1309,7 +1309,6 @@ int mwifiex_scan_networks(struct mwifiex_private *priv,
1309 struct cmd_ctrl_node *cmd_node; 1309 struct cmd_ctrl_node *cmd_node;
1310 union mwifiex_scan_cmd_config_tlv *scan_cfg_out; 1310 union mwifiex_scan_cmd_config_tlv *scan_cfg_out;
1311 struct mwifiex_ie_types_chan_list_param_set *chan_list_out; 1311 struct mwifiex_ie_types_chan_list_param_set *chan_list_out;
1312 u32 buf_size;
1313 struct mwifiex_chan_scan_param_set *scan_chan_list; 1312 struct mwifiex_chan_scan_param_set *scan_chan_list;
1314 u8 filtered_scan; 1313 u8 filtered_scan;
1315 u8 scan_current_chan_only; 1314 u8 scan_current_chan_only;
@@ -1332,18 +1331,16 @@ int mwifiex_scan_networks(struct mwifiex_private *priv,
1332 spin_unlock_irqrestore(&adapter->mwifiex_cmd_lock, flags); 1331 spin_unlock_irqrestore(&adapter->mwifiex_cmd_lock, flags);
1333 1332
1334 scan_cfg_out = kzalloc(sizeof(union mwifiex_scan_cmd_config_tlv), 1333 scan_cfg_out = kzalloc(sizeof(union mwifiex_scan_cmd_config_tlv),
1335 GFP_KERNEL); 1334 GFP_KERNEL);
1336 if (!scan_cfg_out) { 1335 if (!scan_cfg_out) {
1337 dev_err(adapter->dev, "failed to alloc scan_cfg_out\n");
1338 ret = -ENOMEM; 1336 ret = -ENOMEM;
1339 goto done; 1337 goto done;
1340 } 1338 }
1341 1339
1342 buf_size = sizeof(struct mwifiex_chan_scan_param_set) * 1340 scan_chan_list = kcalloc(MWIFIEX_USER_SCAN_CHAN_MAX,
1343 MWIFIEX_USER_SCAN_CHAN_MAX; 1341 sizeof(struct mwifiex_chan_scan_param_set),
1344 scan_chan_list = kzalloc(buf_size, GFP_KERNEL); 1342 GFP_KERNEL);
1345 if (!scan_chan_list) { 1343 if (!scan_chan_list) {
1346 dev_err(adapter->dev, "failed to alloc scan_chan_list\n");
1347 kfree(scan_cfg_out); 1344 kfree(scan_cfg_out);
1348 ret = -ENOMEM; 1345 ret = -ENOMEM;
1349 goto done; 1346 goto done;
@@ -1461,12 +1458,9 @@ static int mwifiex_update_curr_bss_params(struct mwifiex_private *priv,
1461 unsigned long flags; 1458 unsigned long flags;
1462 1459
1463 /* Allocate and fill new bss descriptor */ 1460 /* Allocate and fill new bss descriptor */
1464 bss_desc = kzalloc(sizeof(struct mwifiex_bssdescriptor), 1461 bss_desc = kzalloc(sizeof(struct mwifiex_bssdescriptor), GFP_KERNEL);
1465 GFP_KERNEL); 1462 if (!bss_desc)
1466 if (!bss_desc) {
1467 dev_err(priv->adapter->dev, " failed to alloc bss_desc\n");
1468 return -ENOMEM; 1463 return -ENOMEM;
1469 }
1470 1464
1471 ret = mwifiex_fill_new_bss_desc(priv, bss, bss_desc); 1465 ret = mwifiex_fill_new_bss_desc(priv, bss, bss_desc);
1472 if (ret) 1466 if (ret)
@@ -1879,10 +1873,8 @@ static int mwifiex_scan_specific_ssid(struct mwifiex_private *priv,
1879 } 1873 }
1880 1874
1881 scan_cfg = kzalloc(sizeof(struct mwifiex_user_scan_cfg), GFP_KERNEL); 1875 scan_cfg = kzalloc(sizeof(struct mwifiex_user_scan_cfg), GFP_KERNEL);
1882 if (!scan_cfg) { 1876 if (!scan_cfg)
1883 dev_err(adapter->dev, "failed to alloc scan_cfg\n");
1884 return -ENOMEM; 1877 return -ENOMEM;
1885 }
1886 1878
1887 scan_cfg->ssid_list = req_ssid; 1879 scan_cfg->ssid_list = req_ssid;
1888 scan_cfg->num_ssids = 1; 1880 scan_cfg->num_ssids = 1;
@@ -1996,11 +1988,8 @@ mwifiex_save_curr_bcn(struct mwifiex_private *priv)
1996 kfree(priv->curr_bcn_buf); 1988 kfree(priv->curr_bcn_buf);
1997 priv->curr_bcn_buf = kmalloc(curr_bss->beacon_buf_size, 1989 priv->curr_bcn_buf = kmalloc(curr_bss->beacon_buf_size,
1998 GFP_ATOMIC); 1990 GFP_ATOMIC);
1999 if (!priv->curr_bcn_buf) { 1991 if (!priv->curr_bcn_buf)
2000 dev_err(priv->adapter->dev,
2001 "failed to alloc curr_bcn_buf\n");
2002 return; 1992 return;
2003 }
2004 } 1993 }
2005 1994
2006 memcpy(priv->curr_bcn_buf, curr_bss->beacon_buf, 1995 memcpy(priv->curr_bcn_buf, curr_bss->beacon_buf,
diff --git a/drivers/net/wireless/mwifiex/sdio.c b/drivers/net/wireless/mwifiex/sdio.c
index 5a1c1d0e5599..31d7b2bdaa31 100644
--- a/drivers/net/wireless/mwifiex/sdio.c
+++ b/drivers/net/wireless/mwifiex/sdio.c
@@ -718,11 +718,8 @@ static int mwifiex_prog_fw_w_helper(struct mwifiex_adapter *adapter,
718 718
719 /* Assume that the allocated buffer is 8-byte aligned */ 719 /* Assume that the allocated buffer is 8-byte aligned */
720 fwbuf = kzalloc(MWIFIEX_UPLD_SIZE, GFP_KERNEL); 720 fwbuf = kzalloc(MWIFIEX_UPLD_SIZE, GFP_KERNEL);
721 if (!fwbuf) { 721 if (!fwbuf)
722 dev_err(adapter->dev,
723 "unable to alloc buffer for FW. Terminating dnld\n");
724 return -ENOMEM; 722 return -ENOMEM;
725 }
726 723
727 /* Perform firmware data transfer */ 724 /* Perform firmware data transfer */
728 do { 725 do {
@@ -1520,7 +1517,6 @@ static int mwifiex_alloc_sdio_mpa_buffers(struct mwifiex_adapter *adapter,
1520 1517
1521 card->mpa_tx.buf = kzalloc(mpa_tx_buf_size, GFP_KERNEL); 1518 card->mpa_tx.buf = kzalloc(mpa_tx_buf_size, GFP_KERNEL);
1522 if (!card->mpa_tx.buf) { 1519 if (!card->mpa_tx.buf) {
1523 dev_err(adapter->dev, "could not alloc buffer for MP-A TX\n");
1524 ret = -1; 1520 ret = -1;
1525 goto error; 1521 goto error;
1526 } 1522 }
@@ -1529,7 +1525,6 @@ static int mwifiex_alloc_sdio_mpa_buffers(struct mwifiex_adapter *adapter,
1529 1525
1530 card->mpa_rx.buf = kzalloc(mpa_rx_buf_size, GFP_KERNEL); 1526 card->mpa_rx.buf = kzalloc(mpa_rx_buf_size, GFP_KERNEL);
1531 if (!card->mpa_rx.buf) { 1527 if (!card->mpa_rx.buf) {
1532 dev_err(adapter->dev, "could not alloc buffer for MP-A RX\n");
1533 ret = -1; 1528 ret = -1;
1534 goto error; 1529 goto error;
1535 } 1530 }
@@ -1682,10 +1677,8 @@ static int mwifiex_init_sdio(struct mwifiex_adapter *adapter)
1682 1677
1683 /* Allocate buffers for SDIO MP-A */ 1678 /* Allocate buffers for SDIO MP-A */
1684 card->mp_regs = kzalloc(MAX_MP_REGS, GFP_KERNEL); 1679 card->mp_regs = kzalloc(MAX_MP_REGS, GFP_KERNEL);
1685 if (!card->mp_regs) { 1680 if (!card->mp_regs)
1686 dev_err(adapter->dev, "failed to alloc mp_regs\n");
1687 return -ENOMEM; 1681 return -ENOMEM;
1688 }
1689 1682
1690 ret = mwifiex_alloc_sdio_mpa_buffers(adapter, 1683 ret = mwifiex_alloc_sdio_mpa_buffers(adapter,
1691 SDIO_MP_TX_AGGR_DEF_BUF_SIZE, 1684 SDIO_MP_TX_AGGR_DEF_BUF_SIZE,
diff --git a/drivers/net/wireless/mwifiex/sta_ioctl.c b/drivers/net/wireless/mwifiex/sta_ioctl.c
index f542bb8ccbc8..b8fa76a2b953 100644
--- a/drivers/net/wireless/mwifiex/sta_ioctl.c
+++ b/drivers/net/wireless/mwifiex/sta_ioctl.c
@@ -266,11 +266,9 @@ int mwifiex_bss_start(struct mwifiex_private *priv, struct cfg80211_bss *bss,
266 266
267 /* Allocate and fill new bss descriptor */ 267 /* Allocate and fill new bss descriptor */
268 bss_desc = kzalloc(sizeof(struct mwifiex_bssdescriptor), 268 bss_desc = kzalloc(sizeof(struct mwifiex_bssdescriptor),
269 GFP_KERNEL); 269 GFP_KERNEL);
270 if (!bss_desc) { 270 if (!bss_desc)
271 dev_err(priv->adapter->dev, " failed to alloc bss_desc\n");
272 return -ENOMEM; 271 return -ENOMEM;
273 }
274 272
275 ret = mwifiex_fill_new_bss_desc(priv, bss, bss_desc); 273 ret = mwifiex_fill_new_bss_desc(priv, bss, bss_desc);
276 if (ret) 274 if (ret)
@@ -636,11 +634,8 @@ int mwifiex_set_tx_power(struct mwifiex_private *priv,
636 } 634 }
637 } 635 }
638 buf = kzalloc(MWIFIEX_SIZE_OF_CMD_BUFFER, GFP_KERNEL); 636 buf = kzalloc(MWIFIEX_SIZE_OF_CMD_BUFFER, GFP_KERNEL);
639 if (!buf) { 637 if (!buf)
640 dev_err(priv->adapter->dev, "%s: failed to alloc cmd buffer\n",
641 __func__);
642 return -ENOMEM; 638 return -ENOMEM;
643 }
644 639
645 txp_cfg = (struct host_cmd_ds_txpwr_cfg *) buf; 640 txp_cfg = (struct host_cmd_ds_txpwr_cfg *) buf;
646 txp_cfg->action = cpu_to_le16(HostCmd_ACT_GEN_SET); 641 txp_cfg->action = cpu_to_le16(HostCmd_ACT_GEN_SET);
diff --git a/drivers/net/wireless/mwifiex/wmm.c b/drivers/net/wireless/mwifiex/wmm.c
index 135d96df2063..32adc878041d 100644
--- a/drivers/net/wireless/mwifiex/wmm.c
+++ b/drivers/net/wireless/mwifiex/wmm.c
@@ -109,12 +109,9 @@ mwifiex_wmm_allocate_ralist_node(struct mwifiex_adapter *adapter, u8 *ra)
109 struct mwifiex_ra_list_tbl *ra_list; 109 struct mwifiex_ra_list_tbl *ra_list;
110 110
111 ra_list = kzalloc(sizeof(struct mwifiex_ra_list_tbl), GFP_ATOMIC); 111 ra_list = kzalloc(sizeof(struct mwifiex_ra_list_tbl), GFP_ATOMIC);
112 112 if (!ra_list)
113 if (!ra_list) {
114 dev_err(adapter->dev, "%s: failed to alloc ra_list\n",
115 __func__);
116 return NULL; 113 return NULL;
117 } 114
118 INIT_LIST_HEAD(&ra_list->list); 115 INIT_LIST_HEAD(&ra_list->list);
119 skb_queue_head_init(&ra_list->skb_head); 116 skb_queue_head_init(&ra_list->skb_head);
120 117
diff --git a/drivers/net/wireless/orinoco/main.c b/drivers/net/wireless/orinoco/main.c
index 1e802f82ae49..38ec8d19ac29 100644
--- a/drivers/net/wireless/orinoco/main.c
+++ b/drivers/net/wireless/orinoco/main.c
@@ -853,12 +853,8 @@ void __orinoco_ev_rx(struct net_device *dev, struct hermes *hw)
853 int err; 853 int err;
854 854
855 desc = kmalloc(sizeof(*desc), GFP_ATOMIC); 855 desc = kmalloc(sizeof(*desc), GFP_ATOMIC);
856 if (!desc) { 856 if (!desc)
857 printk(KERN_WARNING
858 "%s: Can't allocate space for RX descriptor\n",
859 dev->name);
860 goto update_stats; 857 goto update_stats;
861 }
862 858
863 rxfid = hermes_read_regn(hw, RXFID); 859 rxfid = hermes_read_regn(hw, RXFID);
864 860
@@ -1336,10 +1332,9 @@ static void qbuf_scan(struct orinoco_private *priv, void *buf,
1336 unsigned long flags; 1332 unsigned long flags;
1337 1333
1338 sd = kmalloc(sizeof(*sd), GFP_ATOMIC); 1334 sd = kmalloc(sizeof(*sd), GFP_ATOMIC);
1339 if (!sd) { 1335 if (!sd)
1340 printk(KERN_ERR "%s: failed to alloc memory\n", __func__);
1341 return; 1336 return;
1342 } 1337
1343 sd->buf = buf; 1338 sd->buf = buf;
1344 sd->len = len; 1339 sd->len = len;
1345 sd->type = type; 1340 sd->type = type;
@@ -1357,10 +1352,9 @@ static void qabort_scan(struct orinoco_private *priv)
1357 unsigned long flags; 1352 unsigned long flags;
1358 1353
1359 sd = kmalloc(sizeof(*sd), GFP_ATOMIC); 1354 sd = kmalloc(sizeof(*sd), GFP_ATOMIC);
1360 if (!sd) { 1355 if (!sd)
1361 printk(KERN_ERR "%s: failed to alloc memory\n", __func__);
1362 return; 1356 return;
1363 } 1357
1364 sd->len = -1; /* Abort */ 1358 sd->len = -1; /* Abort */
1365 1359
1366 spin_lock_irqsave(&priv->scan_lock, flags); 1360 spin_lock_irqsave(&priv->scan_lock, flags);
diff --git a/drivers/net/wireless/p54/p54usb.c b/drivers/net/wireless/p54/p54usb.c
index 800a16526c8e..62ac60737531 100644
--- a/drivers/net/wireless/p54/p54usb.c
+++ b/drivers/net/wireless/p54/p54usb.c
@@ -510,11 +510,8 @@ static int p54u_upload_firmware_3887(struct ieee80211_hw *dev)
510 return err; 510 return err;
511 511
512 tmp = buf = kmalloc(P54U_FW_BLOCK, GFP_KERNEL); 512 tmp = buf = kmalloc(P54U_FW_BLOCK, GFP_KERNEL);
513 if (!buf) { 513 if (!buf)
514 dev_err(&priv->udev->dev, "(p54usb) cannot allocate firmware"
515 "upload buffer!\n");
516 return -ENOMEM; 514 return -ENOMEM;
517 }
518 515
519 left = block_size = min((size_t)P54U_FW_BLOCK, priv->fw->size); 516 left = block_size = min((size_t)P54U_FW_BLOCK, priv->fw->size);
520 strcpy(buf, p54u_firmware_upload_3887); 517 strcpy(buf, p54u_firmware_upload_3887);
@@ -637,11 +634,8 @@ static int p54u_upload_firmware_net2280(struct ieee80211_hw *dev)
637 const u8 *data; 634 const u8 *data;
638 635
639 buf = kmalloc(512, GFP_KERNEL); 636 buf = kmalloc(512, GFP_KERNEL);
640 if (!buf) { 637 if (!buf)
641 dev_err(&priv->udev->dev, "(p54usb) firmware buffer "
642 "alloc failed!\n");
643 return -ENOMEM; 638 return -ENOMEM;
644 }
645 639
646#define P54U_WRITE(type, addr, data) \ 640#define P54U_WRITE(type, addr, data) \
647 do {\ 641 do {\
diff --git a/drivers/net/wireless/prism54/islpci_mgt.c b/drivers/net/wireless/prism54/islpci_mgt.c
index c5404cb59e08..9f19cceab487 100644
--- a/drivers/net/wireless/prism54/islpci_mgt.c
+++ b/drivers/net/wireless/prism54/islpci_mgt.c
@@ -123,11 +123,8 @@ islpci_mgmt_rx_fill(struct net_device *ndev)
123 123
124 if (buf->mem == NULL) { 124 if (buf->mem == NULL) {
125 buf->mem = kmalloc(MGMT_FRAME_SIZE, GFP_ATOMIC); 125 buf->mem = kmalloc(MGMT_FRAME_SIZE, GFP_ATOMIC);
126 if (!buf->mem) { 126 if (!buf->mem)
127 printk(KERN_WARNING
128 "Error allocating management frame.\n");
129 return -ENOMEM; 127 return -ENOMEM;
130 }
131 buf->size = MGMT_FRAME_SIZE; 128 buf->size = MGMT_FRAME_SIZE;
132 } 129 }
133 if (buf->pci_addr == 0) { 130 if (buf->pci_addr == 0) {
@@ -356,14 +353,11 @@ islpci_mgt_receive(struct net_device *ndev)
356 353
357 /* Determine frame size, skipping OID_INL_TUNNEL headers. */ 354 /* Determine frame size, skipping OID_INL_TUNNEL headers. */
358 size = PIMFOR_HEADER_SIZE + header->length; 355 size = PIMFOR_HEADER_SIZE + header->length;
359 frame = kmalloc(sizeof (struct islpci_mgmtframe) + size, 356 frame = kmalloc(sizeof(struct islpci_mgmtframe) + size,
360 GFP_ATOMIC); 357 GFP_ATOMIC);
361 if (!frame) { 358 if (!frame)
362 printk(KERN_WARNING
363 "%s: Out of memory, cannot handle oid 0x%08x\n",
364 ndev->name, header->oid);
365 continue; 359 continue;
366 } 360
367 frame->ndev = ndev; 361 frame->ndev = ndev;
368 memcpy(&frame->buf, header, size); 362 memcpy(&frame->buf, header, size);
369 frame->header = (pimfor_header_t *) frame->buf; 363 frame->header = (pimfor_header_t *) frame->buf;
diff --git a/drivers/net/wireless/rndis_wlan.c b/drivers/net/wireless/rndis_wlan.c
index abe1d039be81..9bb3f22b3669 100644
--- a/drivers/net/wireless/rndis_wlan.c
+++ b/drivers/net/wireless/rndis_wlan.c
@@ -1621,11 +1621,8 @@ static void set_multicast_list(struct usbnet *usbdev)
1621 } else if (mc_count) { 1621 } else if (mc_count) {
1622 int i = 0; 1622 int i = 0;
1623 1623
1624 mc_addrs = kmalloc(mc_count * ETH_ALEN, GFP_ATOMIC); 1624 mc_addrs = kmalloc_array(mc_count, ETH_ALEN, GFP_ATOMIC);
1625 if (!mc_addrs) { 1625 if (!mc_addrs) {
1626 netdev_warn(usbdev->net,
1627 "couldn't alloc %d bytes of memory\n",
1628 mc_count * ETH_ALEN);
1629 netif_addr_unlock_bh(usbdev->net); 1626 netif_addr_unlock_bh(usbdev->net);
1630 return; 1627 return;
1631 } 1628 }
diff --git a/drivers/net/wireless/ti/wlcore/sdio.c b/drivers/net/wireless/ti/wlcore/sdio.c
index 646f703ae739..a3a20be2036f 100644
--- a/drivers/net/wireless/ti/wlcore/sdio.c
+++ b/drivers/net/wireless/ti/wlcore/sdio.c
@@ -229,10 +229,8 @@ static int wl1271_probe(struct sdio_func *func,
229 return -ENODEV; 229 return -ENODEV;
230 230
231 glue = kzalloc(sizeof(*glue), GFP_KERNEL); 231 glue = kzalloc(sizeof(*glue), GFP_KERNEL);
232 if (!glue) { 232 if (!glue)
233 dev_err(&func->dev, "can't allocate glue\n");
234 goto out; 233 goto out;
235 }
236 234
237 glue->dev = &func->dev; 235 glue->dev = &func->dev;
238 236
diff --git a/drivers/net/wireless/ti/wlcore/spi.c b/drivers/net/wireless/ti/wlcore/spi.c
index f06f4770ce02..18cadc07b754 100644
--- a/drivers/net/wireless/ti/wlcore/spi.c
+++ b/drivers/net/wireless/ti/wlcore/spi.c
@@ -87,11 +87,8 @@ static void wl12xx_spi_reset(struct device *child)
87 struct spi_message m; 87 struct spi_message m;
88 88
89 cmd = kzalloc(WSPI_INIT_CMD_LEN, GFP_KERNEL); 89 cmd = kzalloc(WSPI_INIT_CMD_LEN, GFP_KERNEL);
90 if (!cmd) { 90 if (!cmd)
91 dev_err(child->parent,
92 "could not allocate cmd for spi reset\n");
93 return; 91 return;
94 }
95 92
96 memset(&t, 0, sizeof(t)); 93 memset(&t, 0, sizeof(t));
97 spi_message_init(&m); 94 spi_message_init(&m);
@@ -115,11 +112,8 @@ static void wl12xx_spi_init(struct device *child)
115 struct spi_message m; 112 struct spi_message m;
116 113
117 cmd = kzalloc(WSPI_INIT_CMD_LEN, GFP_KERNEL); 114 cmd = kzalloc(WSPI_INIT_CMD_LEN, GFP_KERNEL);
118 if (!cmd) { 115 if (!cmd)
119 dev_err(child->parent,
120 "could not allocate cmd for spi init\n");
121 return; 116 return;
122 }
123 117
124 memset(crc, 0, sizeof(crc)); 118 memset(crc, 0, sizeof(crc));
125 memset(&t, 0, sizeof(t)); 119 memset(&t, 0, sizeof(t));
@@ -340,10 +334,8 @@ static int wl1271_probe(struct spi_device *spi)
340 pdata->ops = &spi_ops; 334 pdata->ops = &spi_ops;
341 335
342 glue = kzalloc(sizeof(*glue), GFP_KERNEL); 336 glue = kzalloc(sizeof(*glue), GFP_KERNEL);
343 if (!glue) { 337 if (!glue)
344 dev_err(&spi->dev, "can't allocate glue\n");
345 goto out; 338 goto out;
346 }
347 339
348 glue->dev = &spi->dev; 340 glue->dev = &spi->dev;
349 341
diff --git a/drivers/net/wireless/zd1211rw/zd_usb.c b/drivers/net/wireless/zd1211rw/zd_usb.c
index ef2b171e3514..7ef0b4a181e1 100644
--- a/drivers/net/wireless/zd1211rw/zd_usb.c
+++ b/drivers/net/wireless/zd1211rw/zd_usb.c
@@ -155,7 +155,6 @@ static int upload_code(struct usb_device *udev,
155 */ 155 */
156 p = kmalloc(MAX_TRANSFER_SIZE, GFP_KERNEL); 156 p = kmalloc(MAX_TRANSFER_SIZE, GFP_KERNEL);
157 if (!p) { 157 if (!p) {
158 dev_err(&udev->dev, "out of memory\n");
159 r = -ENOMEM; 158 r = -ENOMEM;
160 goto error; 159 goto error;
161 } 160 }