diff options
author | Joe Perches <joe@perches.com> | 2013-02-03 12:28:14 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2013-02-04 13:22:34 -0500 |
commit | 0d2e7a5c608063f72048899d20505c2ee130566c (patch) | |
tree | 4eae4acaf7c04bb60337389aaef8065c00b1737a /drivers/net/wireless/mwifiex/scan.c | |
parent | 9d11bd1592fba0b9231d3ce8ab61977db7e03e27 (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/net/wireless/mwifiex/scan.c')
-rw-r--r-- | drivers/net/wireless/mwifiex/scan.c | 27 |
1 files changed, 8 insertions, 19 deletions
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, |