Commit 0d2e7a5c authored by Joe Perches's avatar Joe Perches Committed by David S. Miller

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: default avatarJoe Perches <joe@perches.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 9d11bd15
...@@ -69,10 +69,9 @@ static int airo_probe(struct pcmcia_device *p_dev) ...@@ -69,10 +69,9 @@ static int airo_probe(struct pcmcia_device *p_dev)
/* Allocate space for private device-specific data */ /* Allocate space for private device-specific data */
local = kzalloc(sizeof(local_info_t), GFP_KERNEL); local = kzalloc(sizeof(local_info_t), GFP_KERNEL);
if (!local) { if (!local)
printk(KERN_ERR "airo_cs: no memory for new device\n");
return -ENOMEM; return -ENOMEM;
}
p_dev->priv = local; p_dev->priv = local;
return airo_config(p_dev); return airo_config(p_dev);
......
...@@ -2164,10 +2164,8 @@ static int at76_alloc_urbs(struct at76_priv *priv, ...@@ -2164,10 +2164,8 @@ static int at76_alloc_urbs(struct at76_priv *priv,
buffer_size = sizeof(struct at76_tx_buffer) + MAX_PADDING_SIZE; buffer_size = sizeof(struct at76_tx_buffer) + MAX_PADDING_SIZE;
priv->bulk_out_buffer = kmalloc(buffer_size, GFP_KERNEL); priv->bulk_out_buffer = kmalloc(buffer_size, GFP_KERNEL);
if (!priv->bulk_out_buffer) { if (!priv->bulk_out_buffer)
dev_err(&interface->dev, "cannot allocate output buffer\n");
return -ENOMEM; return -ENOMEM;
}
at76_dbg(DBG_PROC_ENTRY, "%s: EXIT", __func__); at76_dbg(DBG_PROC_ENTRY, "%s: EXIT", __func__);
......
...@@ -288,11 +288,11 @@ struct dfs_pattern_detector * ...@@ -288,11 +288,11 @@ struct dfs_pattern_detector *
dfs_pattern_detector_init(enum nl80211_dfs_regions region) dfs_pattern_detector_init(enum nl80211_dfs_regions region)
{ {
struct dfs_pattern_detector *dpd; struct dfs_pattern_detector *dpd;
dpd = kmalloc(sizeof(*dpd), GFP_KERNEL); dpd = kmalloc(sizeof(*dpd), GFP_KERNEL);
if (dpd == NULL) { if (dpd == NULL)
pr_err("allocation of dfs_pattern_detector failed\n");
return NULL; return NULL;
}
*dpd = default_dpd; *dpd = default_dpd;
INIT_LIST_HEAD(&dpd->channel_detectors); INIT_LIST_HEAD(&dpd->channel_detectors);
......
...@@ -79,10 +79,9 @@ static int atmel_probe(struct pcmcia_device *p_dev) ...@@ -79,10 +79,9 @@ static int atmel_probe(struct pcmcia_device *p_dev)
/* Allocate space for private device-specific data */ /* Allocate space for private device-specific data */
local = kzalloc(sizeof(local_info_t), GFP_KERNEL); local = kzalloc(sizeof(local_info_t), GFP_KERNEL);
if (!local) { if (!local)
printk(KERN_ERR "atmel_cs: no memory for new device\n");
return -ENOMEM; return -ENOMEM;
}
p_dev->priv = local; p_dev->priv = local;
return atmel_config(p_dev); return atmel_config(p_dev);
......
...@@ -4478,13 +4478,10 @@ static int ipw2100_tx_allocate(struct ipw2100_priv *priv) ...@@ -4478,13 +4478,10 @@ static int ipw2100_tx_allocate(struct ipw2100_priv *priv)
return err; return err;
} }
priv->tx_buffers = priv->tx_buffers = kmalloc_array(TX_PENDED_QUEUE_LENGTH,
kmalloc(TX_PENDED_QUEUE_LENGTH * sizeof(struct ipw2100_tx_packet), sizeof(struct ipw2100_tx_packet),
GFP_ATOMIC); GFP_ATOMIC);
if (!priv->tx_buffers) { if (!priv->tx_buffers) {
printk(KERN_ERR DRV_NAME
": %s: alloc failed form tx buffers.\n",
priv->net_dev->name);
bd_queue_free(priv, &priv->tx_queue); bd_queue_free(priv, &priv->tx_queue);
return -ENOMEM; return -ENOMEM;
} }
......
...@@ -2081,10 +2081,8 @@ struct wireless_dev *lbs_cfg_alloc(struct device *dev) ...@@ -2081,10 +2081,8 @@ struct wireless_dev *lbs_cfg_alloc(struct device *dev)
lbs_deb_enter(LBS_DEB_CFG80211); lbs_deb_enter(LBS_DEB_CFG80211);
wdev = kzalloc(sizeof(struct wireless_dev), GFP_KERNEL); wdev = kzalloc(sizeof(struct wireless_dev), GFP_KERNEL);
if (!wdev) { if (!wdev)
dev_err(dev, "cannot allocate wireless device\n");
return ERR_PTR(-ENOMEM); return ERR_PTR(-ENOMEM);
}
wdev->wiphy = wiphy_new(&lbs_cfg80211_ops, sizeof(struct lbs_private)); wdev->wiphy = wiphy_new(&lbs_cfg80211_ops, sizeof(struct lbs_private));
if (!wdev->wiphy) { if (!wdev->wiphy) {
......
...@@ -533,11 +533,8 @@ void mwifiex_create_ba_tbl(struct mwifiex_private *priv, u8 *ra, int tid, ...@@ -533,11 +533,8 @@ void mwifiex_create_ba_tbl(struct mwifiex_private *priv, u8 *ra, int tid,
if (!mwifiex_get_ba_tbl(priv, tid, ra)) { if (!mwifiex_get_ba_tbl(priv, tid, ra)) {
new_node = kzalloc(sizeof(struct mwifiex_tx_ba_stream_tbl), new_node = kzalloc(sizeof(struct mwifiex_tx_ba_stream_tbl),
GFP_ATOMIC); GFP_ATOMIC);
if (!new_node) { if (!new_node)
dev_err(priv->adapter->dev,
"%s: failed to alloc new_node\n", __func__);
return; return;
}
INIT_LIST_HEAD(&new_node->list); INIT_LIST_HEAD(&new_node->list);
......
...@@ -272,11 +272,8 @@ mwifiex_11n_create_rx_reorder_tbl(struct mwifiex_private *priv, u8 *ta, ...@@ -272,11 +272,8 @@ mwifiex_11n_create_rx_reorder_tbl(struct mwifiex_private *priv, u8 *ta,
} }
/* if !tbl then create one */ /* if !tbl then create one */
new_node = kzalloc(sizeof(struct mwifiex_rx_reorder_tbl), GFP_KERNEL); new_node = kzalloc(sizeof(struct mwifiex_rx_reorder_tbl), GFP_KERNEL);
if (!new_node) { if (!new_node)
dev_err(priv->adapter->dev, "%s: failed to alloc new_node\n",
__func__);
return; return;
}
INIT_LIST_HEAD(&new_node->list); INIT_LIST_HEAD(&new_node->list);
new_node->tid = tid; new_node->tid = tid;
......
...@@ -1820,10 +1820,8 @@ mwifiex_cfg80211_scan(struct wiphy *wiphy, ...@@ -1820,10 +1820,8 @@ mwifiex_cfg80211_scan(struct wiphy *wiphy,
priv->user_scan_cfg = kzalloc(sizeof(struct mwifiex_user_scan_cfg), priv->user_scan_cfg = kzalloc(sizeof(struct mwifiex_user_scan_cfg),
GFP_KERNEL); GFP_KERNEL);
if (!priv->user_scan_cfg) { if (!priv->user_scan_cfg)
dev_err(priv->adapter->dev, "failed to alloc scan_req\n");
return -ENOMEM; return -ENOMEM;
}
priv->scan_request = request; priv->scan_request = request;
......
...@@ -334,20 +334,15 @@ static int mwifiex_dnld_sleep_confirm_cmd(struct mwifiex_adapter *adapter) ...@@ -334,20 +334,15 @@ static int mwifiex_dnld_sleep_confirm_cmd(struct mwifiex_adapter *adapter)
int mwifiex_alloc_cmd_buffer(struct mwifiex_adapter *adapter) int mwifiex_alloc_cmd_buffer(struct mwifiex_adapter *adapter)
{ {
struct cmd_ctrl_node *cmd_array; struct cmd_ctrl_node *cmd_array;
u32 buf_size;
u32 i; u32 i;
/* Allocate and initialize struct cmd_ctrl_node */ /* Allocate and initialize struct cmd_ctrl_node */
buf_size = sizeof(struct cmd_ctrl_node) * MWIFIEX_NUM_OF_CMD_BUFFER; cmd_array = kcalloc(MWIFIEX_NUM_OF_CMD_BUFFER,
cmd_array = kzalloc(buf_size, GFP_KERNEL); sizeof(struct cmd_ctrl_node), GFP_KERNEL);
if (!cmd_array) { if (!cmd_array)
dev_err(adapter->dev, "%s: failed to alloc cmd_array\n",
__func__);
return -ENOMEM; return -ENOMEM;
}
adapter->cmd_pool = cmd_array; adapter->cmd_pool = cmd_array;
memset(adapter->cmd_pool, 0, buf_size);
/* Allocate and initialize command buffers */ /* Allocate and initialize command buffers */
for (i = 0; i < MWIFIEX_NUM_OF_CMD_BUFFER; i++) { for (i = 0; i < MWIFIEX_NUM_OF_CMD_BUFFER; i++) {
......
...@@ -39,11 +39,8 @@ static int mwifiex_add_bss_prio_tbl(struct mwifiex_private *priv) ...@@ -39,11 +39,8 @@ static int mwifiex_add_bss_prio_tbl(struct mwifiex_private *priv)
unsigned long flags; unsigned long flags;
bss_prio = kzalloc(sizeof(struct mwifiex_bss_prio_node), GFP_KERNEL); bss_prio = kzalloc(sizeof(struct mwifiex_bss_prio_node), GFP_KERNEL);
if (!bss_prio) { if (!bss_prio)
dev_err(adapter->dev, "%s: failed to alloc bss_prio\n",
__func__);
return -ENOMEM; return -ENOMEM;
}
bss_prio->priv = priv; bss_prio->priv = priv;
INIT_LIST_HEAD(&bss_prio->list); INIT_LIST_HEAD(&bss_prio->list);
......
...@@ -1309,7 +1309,6 @@ int mwifiex_scan_networks(struct mwifiex_private *priv, ...@@ -1309,7 +1309,6 @@ int mwifiex_scan_networks(struct mwifiex_private *priv,
struct cmd_ctrl_node *cmd_node; struct cmd_ctrl_node *cmd_node;
union mwifiex_scan_cmd_config_tlv *scan_cfg_out; union mwifiex_scan_cmd_config_tlv *scan_cfg_out;
struct mwifiex_ie_types_chan_list_param_set *chan_list_out; struct mwifiex_ie_types_chan_list_param_set *chan_list_out;
u32 buf_size;
struct mwifiex_chan_scan_param_set *scan_chan_list; struct mwifiex_chan_scan_param_set *scan_chan_list;
u8 filtered_scan; u8 filtered_scan;
u8 scan_current_chan_only; u8 scan_current_chan_only;
...@@ -1332,18 +1331,16 @@ int mwifiex_scan_networks(struct mwifiex_private *priv, ...@@ -1332,18 +1331,16 @@ int mwifiex_scan_networks(struct mwifiex_private *priv,
spin_unlock_irqrestore(&adapter->mwifiex_cmd_lock, flags); spin_unlock_irqrestore(&adapter->mwifiex_cmd_lock, flags);
scan_cfg_out = kzalloc(sizeof(union mwifiex_scan_cmd_config_tlv), scan_cfg_out = kzalloc(sizeof(union mwifiex_scan_cmd_config_tlv),
GFP_KERNEL); GFP_KERNEL);
if (!scan_cfg_out) { if (!scan_cfg_out) {
dev_err(adapter->dev, "failed to alloc scan_cfg_out\n");
ret = -ENOMEM; ret = -ENOMEM;
goto done; goto done;
} }
buf_size = sizeof(struct mwifiex_chan_scan_param_set) * scan_chan_list = kcalloc(MWIFIEX_USER_SCAN_CHAN_MAX,
MWIFIEX_USER_SCAN_CHAN_MAX; sizeof(struct mwifiex_chan_scan_param_set),
scan_chan_list = kzalloc(buf_size, GFP_KERNEL); GFP_KERNEL);
if (!scan_chan_list) { if (!scan_chan_list) {
dev_err(adapter->dev, "failed to alloc scan_chan_list\n");
kfree(scan_cfg_out); kfree(scan_cfg_out);
ret = -ENOMEM; ret = -ENOMEM;
goto done; goto done;
...@@ -1461,12 +1458,9 @@ static int mwifiex_update_curr_bss_params(struct mwifiex_private *priv, ...@@ -1461,12 +1458,9 @@ static int mwifiex_update_curr_bss_params(struct mwifiex_private *priv,
unsigned long flags; unsigned long flags;
/* Allocate and fill new bss descriptor */ /* Allocate and fill new bss descriptor */
bss_desc = kzalloc(sizeof(struct mwifiex_bssdescriptor), bss_desc = kzalloc(sizeof(struct mwifiex_bssdescriptor), GFP_KERNEL);
GFP_KERNEL); if (!bss_desc)
if (!bss_desc) {
dev_err(priv->adapter->dev, " failed to alloc bss_desc\n");
return -ENOMEM; return -ENOMEM;
}
ret = mwifiex_fill_new_bss_desc(priv, bss, bss_desc); ret = mwifiex_fill_new_bss_desc(priv, bss, bss_desc);
if (ret) if (ret)
...@@ -1879,10 +1873,8 @@ static int mwifiex_scan_specific_ssid(struct mwifiex_private *priv, ...@@ -1879,10 +1873,8 @@ static int mwifiex_scan_specific_ssid(struct mwifiex_private *priv,
} }
scan_cfg = kzalloc(sizeof(struct mwifiex_user_scan_cfg), GFP_KERNEL); scan_cfg = kzalloc(sizeof(struct mwifiex_user_scan_cfg), GFP_KERNEL);
if (!scan_cfg) { if (!scan_cfg)
dev_err(adapter->dev, "failed to alloc scan_cfg\n");
return -ENOMEM; return -ENOMEM;
}
scan_cfg->ssid_list = req_ssid; scan_cfg->ssid_list = req_ssid;
scan_cfg->num_ssids = 1; scan_cfg->num_ssids = 1;
...@@ -1996,11 +1988,8 @@ mwifiex_save_curr_bcn(struct mwifiex_private *priv) ...@@ -1996,11 +1988,8 @@ mwifiex_save_curr_bcn(struct mwifiex_private *priv)
kfree(priv->curr_bcn_buf); kfree(priv->curr_bcn_buf);
priv->curr_bcn_buf = kmalloc(curr_bss->beacon_buf_size, priv->curr_bcn_buf = kmalloc(curr_bss->beacon_buf_size,
GFP_ATOMIC); GFP_ATOMIC);
if (!priv->curr_bcn_buf) { if (!priv->curr_bcn_buf)
dev_err(priv->adapter->dev,
"failed to alloc curr_bcn_buf\n");
return; return;
}
} }
memcpy(priv->curr_bcn_buf, curr_bss->beacon_buf, memcpy(priv->curr_bcn_buf, curr_bss->beacon_buf,
......
...@@ -718,11 +718,8 @@ static int mwifiex_prog_fw_w_helper(struct mwifiex_adapter *adapter, ...@@ -718,11 +718,8 @@ static int mwifiex_prog_fw_w_helper(struct mwifiex_adapter *adapter,
/* Assume that the allocated buffer is 8-byte aligned */ /* Assume that the allocated buffer is 8-byte aligned */
fwbuf = kzalloc(MWIFIEX_UPLD_SIZE, GFP_KERNEL); fwbuf = kzalloc(MWIFIEX_UPLD_SIZE, GFP_KERNEL);
if (!fwbuf) { if (!fwbuf)
dev_err(adapter->dev,
"unable to alloc buffer for FW. Terminating dnld\n");
return -ENOMEM; return -ENOMEM;
}
/* Perform firmware data transfer */ /* Perform firmware data transfer */
do { do {
...@@ -1520,7 +1517,6 @@ static int mwifiex_alloc_sdio_mpa_buffers(struct mwifiex_adapter *adapter, ...@@ -1520,7 +1517,6 @@ static int mwifiex_alloc_sdio_mpa_buffers(struct mwifiex_adapter *adapter,
card->mpa_tx.buf = kzalloc(mpa_tx_buf_size, GFP_KERNEL); card->mpa_tx.buf = kzalloc(mpa_tx_buf_size, GFP_KERNEL);
if (!card->mpa_tx.buf) { if (!card->mpa_tx.buf) {
dev_err(adapter->dev, "could not alloc buffer for MP-A TX\n");
ret = -1; ret = -1;
goto error; goto error;
} }
...@@ -1529,7 +1525,6 @@ static int mwifiex_alloc_sdio_mpa_buffers(struct mwifiex_adapter *adapter, ...@@ -1529,7 +1525,6 @@ static int mwifiex_alloc_sdio_mpa_buffers(struct mwifiex_adapter *adapter,
card->mpa_rx.buf = kzalloc(mpa_rx_buf_size, GFP_KERNEL); card->mpa_rx.buf = kzalloc(mpa_rx_buf_size, GFP_KERNEL);
if (!card->mpa_rx.buf) { if (!card->mpa_rx.buf) {
dev_err(adapter->dev, "could not alloc buffer for MP-A RX\n");
ret = -1; ret = -1;
goto error; goto error;
} }
...@@ -1682,10 +1677,8 @@ static int mwifiex_init_sdio(struct mwifiex_adapter *adapter) ...@@ -1682,10 +1677,8 @@ static int mwifiex_init_sdio(struct mwifiex_adapter *adapter)
/* Allocate buffers for SDIO MP-A */ /* Allocate buffers for SDIO MP-A */
card->mp_regs = kzalloc(MAX_MP_REGS, GFP_KERNEL); card->mp_regs = kzalloc(MAX_MP_REGS, GFP_KERNEL);
if (!card->mp_regs) { if (!card->mp_regs)
dev_err(adapter->dev, "failed to alloc mp_regs\n");
return -ENOMEM; return -ENOMEM;
}
ret = mwifiex_alloc_sdio_mpa_buffers(adapter, ret = mwifiex_alloc_sdio_mpa_buffers(adapter,
SDIO_MP_TX_AGGR_DEF_BUF_SIZE, SDIO_MP_TX_AGGR_DEF_BUF_SIZE,
......
...@@ -266,11 +266,9 @@ int mwifiex_bss_start(struct mwifiex_private *priv, struct cfg80211_bss *bss, ...@@ -266,11 +266,9 @@ int mwifiex_bss_start(struct mwifiex_private *priv, struct cfg80211_bss *bss,
/* Allocate and fill new bss descriptor */ /* Allocate and fill new bss descriptor */
bss_desc = kzalloc(sizeof(struct mwifiex_bssdescriptor), bss_desc = kzalloc(sizeof(struct mwifiex_bssdescriptor),
GFP_KERNEL); GFP_KERNEL);
if (!bss_desc) { if (!bss_desc)
dev_err(priv->adapter->dev, " failed to alloc bss_desc\n");
return -ENOMEM; return -ENOMEM;
}
ret = mwifiex_fill_new_bss_desc(priv, bss, bss_desc); ret = mwifiex_fill_new_bss_desc(priv, bss, bss_desc);
if (ret) if (ret)
...@@ -636,11 +634,8 @@ int mwifiex_set_tx_power(struct mwifiex_private *priv, ...@@ -636,11 +634,8 @@ int mwifiex_set_tx_power(struct mwifiex_private *priv,
} }
} }
buf = kzalloc(MWIFIEX_SIZE_OF_CMD_BUFFER, GFP_KERNEL); buf = kzalloc(MWIFIEX_SIZE_OF_CMD_BUFFER, GFP_KERNEL);
if (!buf) { if (!buf)
dev_err(priv->adapter->dev, "%s: failed to alloc cmd buffer\n",
__func__);
return -ENOMEM; return -ENOMEM;
}
txp_cfg = (struct host_cmd_ds_txpwr_cfg *) buf; txp_cfg = (struct host_cmd_ds_txpwr_cfg *) buf;
txp_cfg->action = cpu_to_le16(HostCmd_ACT_GEN_SET); txp_cfg->action = cpu_to_le16(HostCmd_ACT_GEN_SET);
......
...@@ -109,12 +109,9 @@ mwifiex_wmm_allocate_ralist_node(struct mwifiex_adapter *adapter, u8 *ra) ...@@ -109,12 +109,9 @@ mwifiex_wmm_allocate_ralist_node(struct mwifiex_adapter *adapter, u8 *ra)
struct mwifiex_ra_list_tbl *ra_list; struct mwifiex_ra_list_tbl *ra_list;
ra_list = kzalloc(sizeof(struct mwifiex_ra_list_tbl), GFP_ATOMIC); ra_list = kzalloc(sizeof(struct mwifiex_ra_list_tbl), GFP_ATOMIC);
if (!ra_list)
if (!ra_list) {
dev_err(adapter->dev, "%s: failed to alloc ra_list\n",
__func__);
return NULL; return NULL;
}
INIT_LIST_HEAD(&ra_list->list); INIT_LIST_HEAD(&ra_list->list);
skb_queue_head_init(&ra_list->skb_head); skb_queue_head_init(&ra_list->skb_head);
......
...@@ -853,12 +853,8 @@ void __orinoco_ev_rx(struct net_device *dev, struct hermes *hw) ...@@ -853,12 +853,8 @@ void __orinoco_ev_rx(struct net_device *dev, struct hermes *hw)
int err; int err;
desc = kmalloc(sizeof(*desc), GFP_ATOMIC); desc = kmalloc(sizeof(*desc), GFP_ATOMIC);
if (!desc) { if (!desc)
printk(KERN_WARNING
"%s: Can't allocate space for RX descriptor\n",
dev->name);
goto update_stats; goto update_stats;
}
rxfid = hermes_read_regn(hw, RXFID); rxfid = hermes_read_regn(hw, RXFID);
...@@ -1336,10 +1332,9 @@ static void qbuf_scan(struct orinoco_private *priv, void *buf, ...@@ -1336,10 +1332,9 @@ static void qbuf_scan(struct orinoco_private *priv, void *buf,
unsigned long flags; unsigned long flags;
sd = kmalloc(sizeof(*sd), GFP_ATOMIC); sd = kmalloc(sizeof(*sd), GFP_ATOMIC);
if (!sd) { if (!sd)
printk(KERN_ERR "%s: failed to alloc memory\n", __func__);
return; return;
}
sd->buf = buf; sd->buf = buf;
sd->len = len; sd->len = len;
sd->type = type; sd->type = type;
...@@ -1357,10 +1352,9 @@ static void qabort_scan(struct orinoco_private *priv) ...@@ -1357,10 +1352,9 @@ static void qabort_scan(struct orinoco_private *priv)
unsigned long flags; unsigned long flags;
sd = kmalloc(sizeof(*sd), GFP_ATOMIC); sd = kmalloc(sizeof(*sd), GFP_ATOMIC);
if (!sd) { if (!sd)
printk(KERN_ERR "%s: failed to alloc memory\n", __func__);
return; return;
}
sd->len = -1; /* Abort */ sd->len = -1; /* Abort */
spin_lock_irqsave(&priv->scan_lock, flags); spin_lock_irqsave(&priv->scan_lock, flags);
......
...@@ -510,11 +510,8 @@ static int p54u_upload_firmware_3887(struct ieee80211_hw *dev) ...@@ -510,11 +510,8 @@ static int p54u_upload_firmware_3887(struct ieee80211_hw *dev)
return err; return err;
tmp = buf = kmalloc(P54U_FW_BLOCK, GFP_KERNEL); tmp = buf = kmalloc(P54U_FW_BLOCK, GFP_KERNEL);
if (!buf) { if (!buf)
dev_err(&priv->udev->dev, "(p54usb) cannot allocate firmware"
"upload buffer!\n");
return -ENOMEM; return -ENOMEM;
}
left = block_size = min((size_t)P54U_FW_BLOCK, priv->fw->size); left = block_size = min((size_t)P54U_FW_BLOCK, priv->fw->size);
strcpy(buf, p54u_firmware_upload_3887); strcpy(buf, p54u_firmware_upload_3887);
...@@ -637,11 +634,8 @@ static int p54u_upload_firmware_net2280(struct ieee80211_hw *dev) ...@@ -637,11 +634,8 @@ static int p54u_upload_firmware_net2280(struct ieee80211_hw *dev)
const u8 *data; const u8 *data;
buf = kmalloc(512, GFP_KERNEL); buf = kmalloc(512, GFP_KERNEL);
if (!buf) { if (!buf)
dev_err(&priv->udev->dev, "(p54usb) firmware buffer "
"alloc failed!\n");
return -ENOMEM; return -ENOMEM;
}
#define P54U_WRITE(type, addr, data) \ #define P54U_WRITE(type, addr, data) \
do {\ do {\
......
...@@ -123,11 +123,8 @@ islpci_mgmt_rx_fill(struct net_device *ndev) ...@@ -123,11 +123,8 @@ islpci_mgmt_rx_fill(struct net_device *ndev)
if (buf->mem == NULL) { if (buf->mem == NULL) {
buf->mem = kmalloc(MGMT_FRAME_SIZE, GFP_ATOMIC); buf->mem = kmalloc(MGMT_FRAME_SIZE, GFP_ATOMIC);
if (!buf->mem) { if (!buf->mem)
printk(KERN_WARNING
"Error allocating management frame.\n");
return -ENOMEM; return -ENOMEM;
}
buf->size = MGMT_FRAME_SIZE; buf->size = MGMT_FRAME_SIZE;
} }
if (buf->pci_addr == 0) { if (buf->pci_addr == 0) {
...@@ -356,14 +353,11 @@ islpci_mgt_receive(struct net_device *ndev) ...@@ -356,14 +353,11 @@ islpci_mgt_receive(struct net_device *ndev)
/* Determine frame size, skipping OID_INL_TUNNEL headers. */ /* Determine frame size, skipping OID_INL_TUNNEL headers. */
size = PIMFOR_HEADER_SIZE + header->length; size = PIMFOR_HEADER_SIZE + header->length;
frame = kmalloc(sizeof (struct islpci_mgmtframe) + size, frame = kmalloc(sizeof(struct islpci_mgmtframe) + size,
GFP_ATOMIC); GFP_ATOMIC);
if (!frame) { if (!frame)
printk(KERN_WARNING
"%s: Out of memory, cannot handle oid 0x%08x\n",
ndev->name, header->oid);
continue; continue;
}
frame->ndev = ndev; frame->ndev = ndev;
memcpy(&frame->buf, header, size); memcpy(&frame->buf, header, size);
frame->header = (pimfor_header_t *) frame->buf; frame->header = (pimfor_header_t *) frame->buf;
......
...@@ -1621,11 +1621,8 @@ static void set_multicast_list(struct usbnet *usbdev) ...@@ -1621,11 +1621,8 @@ static void set_multicast_list(struct usbnet *usbdev)
} else if (mc_count) { } else if (mc_count) {
int i = 0; int i = 0;
mc_addrs = kmalloc(mc_count * ETH_ALEN, GFP_ATOMIC); mc_addrs = kmalloc_array(mc_count, ETH_ALEN, GFP_ATOMIC);
if (!mc_addrs) { if (!mc_addrs) {
netdev_warn(usbdev->net,
"couldn't alloc %d bytes of memory\n",
mc_count * ETH_ALEN);
netif_addr_unlock_bh(usbdev->net); netif_addr_unlock_bh(usbdev->net);
return; return;
} }
......
...@@ -229,10 +229,8 @@ static int wl1271_probe(struct sdio_func *func, ...@@ -229,10 +229,8 @@ static int wl1271_probe(struct sdio_func *func,
return -ENODEV; return -ENODEV;
glue = kzalloc(sizeof(*glue), GFP_KERNEL); glue = kzalloc(sizeof(*glue), GFP_KERNEL);
if (!glue) { if (!glue)
dev_err(&func->dev, "can't allocate glue\n");
goto out; goto out;
}
glue->dev = &func->dev; glue->dev = &func->dev;
......
...@@ -87,11 +87,8 @@ static void wl12xx_spi_reset(struct device *child) ...@@ -87,11 +87,8 @@ static void wl12xx_spi_reset(struct device *child)
struct spi_message m; struct spi_message m;
cmd = kzalloc(WSPI_INIT_CMD_LEN, GFP_KERNEL); cmd = kzalloc(WSPI_INIT_CMD_LEN, GFP_KERNEL);
if (!cmd) { if (!cmd)
dev_err(child->parent,
"could not allocate cmd for spi reset\n");
return; return;
}
memset(&t, 0, sizeof(t)); memset(&t, 0, sizeof(t));
spi_message_init(&m); spi_message_init(&m);
...@@ -115,11 +112,8 @@ static void wl12xx_spi_init(struct device *child) ...@@ -115,11 +112,8 @@ static void wl12xx_spi_init(struct device *child)
struct spi_message m; struct spi_message m;
cmd = kzalloc(WSPI_INIT_CMD_LEN, GFP_KERNEL); cmd = kzalloc(WSPI_INIT_CMD_LEN, GFP_KERNEL);
if (!cmd) { if (!cmd)
dev_err(child->parent,
"could not allocate cmd for spi init\n");
return; return;
}
memset(crc, 0, sizeof(crc)); memset(crc, 0, sizeof(crc));
memset(&t, 0, sizeof(t)); memset(&t, 0, sizeof(t));
...@@ -340,10 +334,8 @@ static int wl1271_probe(struct spi_device *spi) ...@@ -340,10 +334,8 @@ static int wl1271_probe(struct spi_device *spi)
pdata->ops = &spi_ops; pdata->ops = &spi_ops;
glue = kzalloc(sizeof(*glue), GFP_KERNEL); glue = kzalloc(sizeof(*glue), GFP_KERNEL);
if (!glue) { if (!glue)
dev_err(&spi->dev, "can't allocate glue\n");
goto out; goto out;
}
glue->dev = &spi->dev; glue->dev = &spi->dev;
......
...@@ -155,7 +155,6 @@ static int upload_code(struct usb_device *udev, ...@@ -155,7 +155,6 @@ static int upload_code(struct usb_device *udev,
*/ */
p = kmalloc(MAX_TRANSFER_SIZE, GFP_KERNEL); p = kmalloc(MAX_TRANSFER_SIZE, GFP_KERNEL);
if (!p) { if (!p) {
dev_err(&udev->dev, "out of memory\n");
r = -ENOMEM; r = -ENOMEM;
goto error; goto error;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment