mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-07-11 00:51:47 +00:00
drivers: net: Remove remaining alloc/OOM messages
alloc failures already get standardized OOM messages and a dump_stack. For the affected mallocs around these OOM messages: Converted kmallocs with multiplies to kmalloc_array. Converted a kmalloc/memcpy to kmemdup. Removed now unused stack variables. Removed unnecessary parentheses. Neatened alignment. Signed-off-by: Joe Perches <joe@perches.com> Acked-by: Arend van Spriel <arend@broadcom.com> Acked-by: Marc Kleine-Budde <mkl@pengutronix.de> Acked-by: John W. Linville <linville@tuxdriver.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
e9ba103931
commit
14f8dc4953
20 changed files with 66 additions and 150 deletions
|
@ -1019,10 +1019,8 @@ static int ems_usb_probe(struct usb_interface *intf,
|
||||||
|
|
||||||
dev->tx_msg_buffer = kzalloc(CPC_HEADER_SIZE +
|
dev->tx_msg_buffer = kzalloc(CPC_HEADER_SIZE +
|
||||||
sizeof(struct ems_cpc_msg), GFP_KERNEL);
|
sizeof(struct ems_cpc_msg), GFP_KERNEL);
|
||||||
if (!dev->tx_msg_buffer) {
|
if (!dev->tx_msg_buffer)
|
||||||
dev_err(&intf->dev, "Couldn't alloc Tx buffer\n");
|
|
||||||
goto cleanup_intr_in_buffer;
|
goto cleanup_intr_in_buffer;
|
||||||
}
|
|
||||||
|
|
||||||
usb_set_intfdata(intf, dev);
|
usb_set_intfdata(intf, dev);
|
||||||
|
|
||||||
|
|
|
@ -494,19 +494,15 @@ static void pcnet32_realloc_tx_ring(struct net_device *dev,
|
||||||
}
|
}
|
||||||
memset(new_tx_ring, 0, sizeof(struct pcnet32_tx_head) * (1 << size));
|
memset(new_tx_ring, 0, sizeof(struct pcnet32_tx_head) * (1 << size));
|
||||||
|
|
||||||
new_dma_addr_list = kcalloc((1 << size), sizeof(dma_addr_t),
|
new_dma_addr_list = kcalloc(1 << size, sizeof(dma_addr_t),
|
||||||
GFP_ATOMIC);
|
GFP_ATOMIC);
|
||||||
if (!new_dma_addr_list) {
|
if (!new_dma_addr_list)
|
||||||
netif_err(lp, drv, dev, "Memory allocation failed\n");
|
|
||||||
goto free_new_tx_ring;
|
goto free_new_tx_ring;
|
||||||
}
|
|
||||||
|
|
||||||
new_skb_list = kcalloc((1 << size), sizeof(struct sk_buff *),
|
new_skb_list = kcalloc(1 << size, sizeof(struct sk_buff *),
|
||||||
GFP_ATOMIC);
|
GFP_ATOMIC);
|
||||||
if (!new_skb_list) {
|
if (!new_skb_list)
|
||||||
netif_err(lp, drv, dev, "Memory allocation failed\n");
|
|
||||||
goto free_new_lists;
|
goto free_new_lists;
|
||||||
}
|
|
||||||
|
|
||||||
kfree(lp->tx_skbuff);
|
kfree(lp->tx_skbuff);
|
||||||
kfree(lp->tx_dma_addr);
|
kfree(lp->tx_dma_addr);
|
||||||
|
@ -564,19 +560,14 @@ static void pcnet32_realloc_rx_ring(struct net_device *dev,
|
||||||
}
|
}
|
||||||
memset(new_rx_ring, 0, sizeof(struct pcnet32_rx_head) * (1 << size));
|
memset(new_rx_ring, 0, sizeof(struct pcnet32_rx_head) * (1 << size));
|
||||||
|
|
||||||
new_dma_addr_list = kcalloc((1 << size), sizeof(dma_addr_t),
|
new_dma_addr_list = kcalloc(1 << size, sizeof(dma_addr_t), GFP_ATOMIC);
|
||||||
GFP_ATOMIC);
|
if (!new_dma_addr_list)
|
||||||
if (!new_dma_addr_list) {
|
|
||||||
netif_err(lp, drv, dev, "Memory allocation failed\n");
|
|
||||||
goto free_new_rx_ring;
|
goto free_new_rx_ring;
|
||||||
}
|
|
||||||
|
|
||||||
new_skb_list = kcalloc((1 << size), sizeof(struct sk_buff *),
|
new_skb_list = kcalloc(1 << size, sizeof(struct sk_buff *),
|
||||||
GFP_ATOMIC);
|
GFP_ATOMIC);
|
||||||
if (!new_skb_list) {
|
if (!new_skb_list)
|
||||||
netif_err(lp, drv, dev, "Memory allocation failed\n");
|
|
||||||
goto free_new_lists;
|
goto free_new_lists;
|
||||||
}
|
|
||||||
|
|
||||||
/* first copy the current receive buffers */
|
/* first copy the current receive buffers */
|
||||||
overlap = min(size, lp->rx_ring_size);
|
overlap = min(size, lp->rx_ring_size);
|
||||||
|
@ -1933,31 +1924,23 @@ static int pcnet32_alloc_ring(struct net_device *dev, const char *name)
|
||||||
|
|
||||||
lp->tx_dma_addr = kcalloc(lp->tx_ring_size, sizeof(dma_addr_t),
|
lp->tx_dma_addr = kcalloc(lp->tx_ring_size, sizeof(dma_addr_t),
|
||||||
GFP_ATOMIC);
|
GFP_ATOMIC);
|
||||||
if (!lp->tx_dma_addr) {
|
if (!lp->tx_dma_addr)
|
||||||
netif_err(lp, drv, dev, "Memory allocation failed\n");
|
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
|
||||||
|
|
||||||
lp->rx_dma_addr = kcalloc(lp->rx_ring_size, sizeof(dma_addr_t),
|
lp->rx_dma_addr = kcalloc(lp->rx_ring_size, sizeof(dma_addr_t),
|
||||||
GFP_ATOMIC);
|
GFP_ATOMIC);
|
||||||
if (!lp->rx_dma_addr) {
|
if (!lp->rx_dma_addr)
|
||||||
netif_err(lp, drv, dev, "Memory allocation failed\n");
|
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
|
||||||
|
|
||||||
lp->tx_skbuff = kcalloc(lp->tx_ring_size, sizeof(struct sk_buff *),
|
lp->tx_skbuff = kcalloc(lp->tx_ring_size, sizeof(struct sk_buff *),
|
||||||
GFP_ATOMIC);
|
GFP_ATOMIC);
|
||||||
if (!lp->tx_skbuff) {
|
if (!lp->tx_skbuff)
|
||||||
netif_err(lp, drv, dev, "Memory allocation failed\n");
|
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
|
||||||
|
|
||||||
lp->rx_skbuff = kcalloc(lp->rx_ring_size, sizeof(struct sk_buff *),
|
lp->rx_skbuff = kcalloc(lp->rx_ring_size, sizeof(struct sk_buff *),
|
||||||
GFP_ATOMIC);
|
GFP_ATOMIC);
|
||||||
if (!lp->rx_skbuff) {
|
if (!lp->rx_skbuff)
|
||||||
netif_err(lp, drv, dev, "Memory allocation failed\n");
|
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -277,14 +277,12 @@ static int gfar_alloc_skb_resources(struct net_device *ndev)
|
||||||
/* Setup the skbuff rings */
|
/* Setup the skbuff rings */
|
||||||
for (i = 0; i < priv->num_tx_queues; i++) {
|
for (i = 0; i < priv->num_tx_queues; i++) {
|
||||||
tx_queue = priv->tx_queue[i];
|
tx_queue = priv->tx_queue[i];
|
||||||
tx_queue->tx_skbuff = kmalloc(sizeof(*tx_queue->tx_skbuff) *
|
tx_queue->tx_skbuff =
|
||||||
tx_queue->tx_ring_size,
|
kmalloc_array(tx_queue->tx_ring_size,
|
||||||
GFP_KERNEL);
|
sizeof(*tx_queue->tx_skbuff),
|
||||||
if (!tx_queue->tx_skbuff) {
|
GFP_KERNEL);
|
||||||
netif_err(priv, ifup, ndev,
|
if (!tx_queue->tx_skbuff)
|
||||||
"Could not allocate tx_skbuff\n");
|
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
|
||||||
|
|
||||||
for (k = 0; k < tx_queue->tx_ring_size; k++)
|
for (k = 0; k < tx_queue->tx_ring_size; k++)
|
||||||
tx_queue->tx_skbuff[k] = NULL;
|
tx_queue->tx_skbuff[k] = NULL;
|
||||||
|
@ -292,15 +290,12 @@ static int gfar_alloc_skb_resources(struct net_device *ndev)
|
||||||
|
|
||||||
for (i = 0; i < priv->num_rx_queues; i++) {
|
for (i = 0; i < priv->num_rx_queues; i++) {
|
||||||
rx_queue = priv->rx_queue[i];
|
rx_queue = priv->rx_queue[i];
|
||||||
rx_queue->rx_skbuff = kmalloc(sizeof(*rx_queue->rx_skbuff) *
|
rx_queue->rx_skbuff =
|
||||||
rx_queue->rx_ring_size,
|
kmalloc_array(rx_queue->rx_ring_size,
|
||||||
GFP_KERNEL);
|
sizeof(*rx_queue->rx_skbuff),
|
||||||
|
GFP_KERNEL);
|
||||||
if (!rx_queue->rx_skbuff) {
|
if (!rx_queue->rx_skbuff)
|
||||||
netif_err(priv, ifup, ndev,
|
|
||||||
"Could not allocate rx_skbuff\n");
|
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
|
||||||
|
|
||||||
for (j = 0; j < rx_queue->rx_ring_size; j++)
|
for (j = 0; j < rx_queue->rx_ring_size; j++)
|
||||||
rx_queue->rx_skbuff[j] = NULL;
|
rx_queue->rx_skbuff[j] = NULL;
|
||||||
|
|
|
@ -1509,11 +1509,8 @@ static int e1000_setup_tx_resources(struct e1000_adapter *adapter,
|
||||||
|
|
||||||
size = sizeof(struct e1000_buffer) * txdr->count;
|
size = sizeof(struct e1000_buffer) * txdr->count;
|
||||||
txdr->buffer_info = vzalloc(size);
|
txdr->buffer_info = vzalloc(size);
|
||||||
if (!txdr->buffer_info) {
|
if (!txdr->buffer_info)
|
||||||
e_err(probe, "Unable to allocate memory for the Tx descriptor "
|
|
||||||
"ring\n");
|
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
|
||||||
|
|
||||||
/* round up to nearest 4K */
|
/* round up to nearest 4K */
|
||||||
|
|
||||||
|
@ -1704,11 +1701,8 @@ static int e1000_setup_rx_resources(struct e1000_adapter *adapter,
|
||||||
|
|
||||||
size = sizeof(struct e1000_buffer) * rxdr->count;
|
size = sizeof(struct e1000_buffer) * rxdr->count;
|
||||||
rxdr->buffer_info = vzalloc(size);
|
rxdr->buffer_info = vzalloc(size);
|
||||||
if (!rxdr->buffer_info) {
|
if (!rxdr->buffer_info)
|
||||||
e_err(probe, "Unable to allocate memory for the Rx descriptor "
|
|
||||||
"ring\n");
|
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
|
||||||
|
|
||||||
desc_len = sizeof(struct e1000_rx_desc);
|
desc_len = sizeof(struct e1000_rx_desc);
|
||||||
|
|
||||||
|
@ -2252,10 +2246,8 @@ static void e1000_set_rx_mode(struct net_device *netdev)
|
||||||
int mta_reg_count = E1000_NUM_MTA_REGISTERS;
|
int mta_reg_count = E1000_NUM_MTA_REGISTERS;
|
||||||
u32 *mcarray = kcalloc(mta_reg_count, sizeof(u32), GFP_ATOMIC);
|
u32 *mcarray = kcalloc(mta_reg_count, sizeof(u32), GFP_ATOMIC);
|
||||||
|
|
||||||
if (!mcarray) {
|
if (!mcarray)
|
||||||
e_err(probe, "memory allocation failed\n");
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
/* Check for Promiscuous and All Multicast modes */
|
/* Check for Promiscuous and All Multicast modes */
|
||||||
|
|
||||||
|
|
|
@ -708,11 +708,8 @@ ixgb_setup_tx_resources(struct ixgb_adapter *adapter)
|
||||||
|
|
||||||
size = sizeof(struct ixgb_buffer) * txdr->count;
|
size = sizeof(struct ixgb_buffer) * txdr->count;
|
||||||
txdr->buffer_info = vzalloc(size);
|
txdr->buffer_info = vzalloc(size);
|
||||||
if (!txdr->buffer_info) {
|
if (!txdr->buffer_info)
|
||||||
netif_err(adapter, probe, adapter->netdev,
|
|
||||||
"Unable to allocate transmit descriptor ring memory\n");
|
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
|
||||||
|
|
||||||
/* round up to nearest 4K */
|
/* round up to nearest 4K */
|
||||||
|
|
||||||
|
@ -797,11 +794,8 @@ ixgb_setup_rx_resources(struct ixgb_adapter *adapter)
|
||||||
|
|
||||||
size = sizeof(struct ixgb_buffer) * rxdr->count;
|
size = sizeof(struct ixgb_buffer) * rxdr->count;
|
||||||
rxdr->buffer_info = vzalloc(size);
|
rxdr->buffer_info = vzalloc(size);
|
||||||
if (!rxdr->buffer_info) {
|
if (!rxdr->buffer_info)
|
||||||
netif_err(adapter, probe, adapter->netdev,
|
|
||||||
"Unable to allocate receive descriptor ring\n");
|
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
|
||||||
|
|
||||||
/* Round up to nearest 4K */
|
/* Round up to nearest 4K */
|
||||||
|
|
||||||
|
|
|
@ -716,10 +716,8 @@ int ixgbe_setup_fcoe_ddp_resources(struct ixgbe_adapter *adapter)
|
||||||
|
|
||||||
/* Extra buffer to be shared by all DDPs for HW work around */
|
/* Extra buffer to be shared by all DDPs for HW work around */
|
||||||
buffer = kmalloc(IXGBE_FCBUFF_MIN, GFP_ATOMIC);
|
buffer = kmalloc(IXGBE_FCBUFF_MIN, GFP_ATOMIC);
|
||||||
if (!buffer) {
|
if (!buffer)
|
||||||
e_err(drv, "failed to allocate extra DDP buffer\n");
|
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
|
||||||
|
|
||||||
dma = dma_map_single(dev, buffer, IXGBE_FCBUFF_MIN, DMA_FROM_DEVICE);
|
dma = dma_map_single(dev, buffer, IXGBE_FCBUFF_MIN, DMA_FROM_DEVICE);
|
||||||
if (dma_mapping_error(dev, dma)) {
|
if (dma_mapping_error(dev, dma)) {
|
||||||
|
|
|
@ -741,7 +741,6 @@ static int add_ip_rule(struct mlx4_en_priv *priv,
|
||||||
spec_l3 = kzalloc(sizeof(*spec_l3), GFP_KERNEL);
|
spec_l3 = kzalloc(sizeof(*spec_l3), GFP_KERNEL);
|
||||||
spec_l2 = kzalloc(sizeof(*spec_l2), GFP_KERNEL);
|
spec_l2 = kzalloc(sizeof(*spec_l2), GFP_KERNEL);
|
||||||
if (!spec_l2 || !spec_l3) {
|
if (!spec_l2 || !spec_l3) {
|
||||||
en_err(priv, "Fail to alloc ethtool rule.\n");
|
|
||||||
err = -ENOMEM;
|
err = -ENOMEM;
|
||||||
goto free_spec;
|
goto free_spec;
|
||||||
}
|
}
|
||||||
|
@ -782,7 +781,6 @@ static int add_tcp_udp_rule(struct mlx4_en_priv *priv,
|
||||||
spec_l3 = kzalloc(sizeof(*spec_l3), GFP_KERNEL);
|
spec_l3 = kzalloc(sizeof(*spec_l3), GFP_KERNEL);
|
||||||
spec_l4 = kzalloc(sizeof(*spec_l4), GFP_KERNEL);
|
spec_l4 = kzalloc(sizeof(*spec_l4), GFP_KERNEL);
|
||||||
if (!spec_l2 || !spec_l3 || !spec_l4) {
|
if (!spec_l2 || !spec_l3 || !spec_l4) {
|
||||||
en_err(priv, "Fail to alloc ethtool rule.\n");
|
|
||||||
err = -ENOMEM;
|
err = -ENOMEM;
|
||||||
goto free_spec;
|
goto free_spec;
|
||||||
}
|
}
|
||||||
|
|
|
@ -708,7 +708,6 @@ static void mlx4_en_cache_mclist(struct net_device *dev)
|
||||||
netdev_for_each_mc_addr(ha, dev) {
|
netdev_for_each_mc_addr(ha, dev) {
|
||||||
tmp = kzalloc(sizeof(struct mlx4_en_mc_list), GFP_ATOMIC);
|
tmp = kzalloc(sizeof(struct mlx4_en_mc_list), GFP_ATOMIC);
|
||||||
if (!tmp) {
|
if (!tmp) {
|
||||||
en_err(priv, "failed to allocate multicast list\n");
|
|
||||||
mlx4_en_clear_list(dev);
|
mlx4_en_clear_list(dev);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -752,14 +751,12 @@ static void update_mclist_flags(struct mlx4_en_priv *priv,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!found) {
|
if (!found) {
|
||||||
new_mc = kmalloc(sizeof(struct mlx4_en_mc_list),
|
new_mc = kmemdup(src_tmp,
|
||||||
|
sizeof(struct mlx4_en_mc_list),
|
||||||
GFP_KERNEL);
|
GFP_KERNEL);
|
||||||
if (!new_mc) {
|
if (!new_mc)
|
||||||
en_err(priv, "Failed to allocate current multicast list\n");
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
memcpy(new_mc, src_tmp,
|
|
||||||
sizeof(struct mlx4_en_mc_list));
|
|
||||||
new_mc->action = MCLIST_ADD;
|
new_mc->action = MCLIST_ADD;
|
||||||
list_add_tail(&new_mc->list, dst);
|
list_add_tail(&new_mc->list, dst);
|
||||||
}
|
}
|
||||||
|
|
|
@ -852,11 +852,9 @@ static int mlx4_en_config_rss_qp(struct mlx4_en_priv *priv, int qpn,
|
||||||
struct mlx4_qp_context *context;
|
struct mlx4_qp_context *context;
|
||||||
int err = 0;
|
int err = 0;
|
||||||
|
|
||||||
context = kmalloc(sizeof *context , GFP_KERNEL);
|
context = kmalloc(sizeof(*context), GFP_KERNEL);
|
||||||
if (!context) {
|
if (!context)
|
||||||
en_err(priv, "Failed to allocate qp context\n");
|
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
|
||||||
|
|
||||||
err = mlx4_qp_alloc(mdev->dev, qpn, qp);
|
err = mlx4_qp_alloc(mdev->dev, qpn, qp);
|
||||||
if (err) {
|
if (err) {
|
||||||
|
|
|
@ -2920,14 +2920,11 @@ static int ql_alloc_rx_resources(struct ql_adapter *qdev,
|
||||||
/*
|
/*
|
||||||
* Allocate small buffer queue control blocks.
|
* Allocate small buffer queue control blocks.
|
||||||
*/
|
*/
|
||||||
rx_ring->sbq =
|
rx_ring->sbq = kmalloc_array(rx_ring->sbq_len,
|
||||||
kmalloc(rx_ring->sbq_len * sizeof(struct bq_desc),
|
sizeof(struct bq_desc),
|
||||||
GFP_KERNEL);
|
GFP_KERNEL);
|
||||||
if (rx_ring->sbq == NULL) {
|
if (rx_ring->sbq == NULL)
|
||||||
netif_err(qdev, ifup, qdev->ndev,
|
|
||||||
"Small buffer queue control block allocation failed.\n");
|
|
||||||
goto err_mem;
|
goto err_mem;
|
||||||
}
|
|
||||||
|
|
||||||
ql_init_sbq_ring(qdev, rx_ring);
|
ql_init_sbq_ring(qdev, rx_ring);
|
||||||
}
|
}
|
||||||
|
@ -2948,14 +2945,11 @@ static int ql_alloc_rx_resources(struct ql_adapter *qdev,
|
||||||
/*
|
/*
|
||||||
* Allocate large buffer queue control blocks.
|
* Allocate large buffer queue control blocks.
|
||||||
*/
|
*/
|
||||||
rx_ring->lbq =
|
rx_ring->lbq = kmalloc_array(rx_ring->lbq_len,
|
||||||
kmalloc(rx_ring->lbq_len * sizeof(struct bq_desc),
|
sizeof(struct bq_desc),
|
||||||
GFP_KERNEL);
|
GFP_KERNEL);
|
||||||
if (rx_ring->lbq == NULL) {
|
if (rx_ring->lbq == NULL)
|
||||||
netif_err(qdev, ifup, qdev->ndev,
|
|
||||||
"Large buffer queue control block allocation failed.\n");
|
|
||||||
goto err_mem;
|
goto err_mem;
|
||||||
}
|
|
||||||
|
|
||||||
ql_init_lbq_ring(qdev, rx_ring);
|
ql_init_lbq_ring(qdev, rx_ring);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1250,12 +1250,11 @@ static int smsc9420_alloc_tx_ring(struct smsc9420_pdata *pd)
|
||||||
|
|
||||||
BUG_ON(!pd->tx_ring);
|
BUG_ON(!pd->tx_ring);
|
||||||
|
|
||||||
pd->tx_buffers = kmalloc((sizeof(struct smsc9420_ring_info) *
|
pd->tx_buffers = kmalloc_array(TX_RING_SIZE,
|
||||||
TX_RING_SIZE), GFP_KERNEL);
|
sizeof(struct smsc9420_ring_info),
|
||||||
if (!pd->tx_buffers) {
|
GFP_KERNEL);
|
||||||
smsc_warn(IFUP, "Failed to allocated tx_buffers");
|
if (!pd->tx_buffers)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
|
||||||
|
|
||||||
/* Initialize the TX Ring */
|
/* Initialize the TX Ring */
|
||||||
for (i = 0; i < TX_RING_SIZE; i++) {
|
for (i = 0; i < TX_RING_SIZE; i++) {
|
||||||
|
|
|
@ -149,11 +149,9 @@ static int get_registers(pegasus_t *pegasus, __u16 indx, __u16 size,
|
||||||
DECLARE_WAITQUEUE(wait, current);
|
DECLARE_WAITQUEUE(wait, current);
|
||||||
|
|
||||||
buffer = kmalloc(size, GFP_KERNEL);
|
buffer = kmalloc(size, GFP_KERNEL);
|
||||||
if (!buffer) {
|
if (!buffer)
|
||||||
netif_warn(pegasus, drv, pegasus->net,
|
|
||||||
"out of memory in %s\n", __func__);
|
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
|
||||||
add_wait_queue(&pegasus->ctrl_wait, &wait);
|
add_wait_queue(&pegasus->ctrl_wait, &wait);
|
||||||
set_current_state(TASK_UNINTERRUPTIBLE);
|
set_current_state(TASK_UNINTERRUPTIBLE);
|
||||||
while (pegasus->flags & ETH_REGS_CHANGED)
|
while (pegasus->flags & ETH_REGS_CHANGED)
|
||||||
|
|
|
@ -1196,20 +1196,17 @@ void ath9k_rx_cleanup(struct ath9k_htc_priv *priv)
|
||||||
|
|
||||||
int ath9k_rx_init(struct ath9k_htc_priv *priv)
|
int ath9k_rx_init(struct ath9k_htc_priv *priv)
|
||||||
{
|
{
|
||||||
struct ath_hw *ah = priv->ah;
|
|
||||||
struct ath_common *common = ath9k_hw_common(ah);
|
|
||||||
struct ath9k_htc_rxbuf *rxbuf;
|
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
|
||||||
INIT_LIST_HEAD(&priv->rx.rxbuf);
|
INIT_LIST_HEAD(&priv->rx.rxbuf);
|
||||||
spin_lock_init(&priv->rx.rxbuflock);
|
spin_lock_init(&priv->rx.rxbuflock);
|
||||||
|
|
||||||
for (i = 0; i < ATH9K_HTC_RXBUF; i++) {
|
for (i = 0; i < ATH9K_HTC_RXBUF; i++) {
|
||||||
rxbuf = kzalloc(sizeof(struct ath9k_htc_rxbuf), GFP_KERNEL);
|
struct ath9k_htc_rxbuf *rxbuf =
|
||||||
if (rxbuf == NULL) {
|
kzalloc(sizeof(struct ath9k_htc_rxbuf), GFP_KERNEL);
|
||||||
ath_err(common, "Unable to allocate RX buffers\n");
|
if (rxbuf == NULL)
|
||||||
goto err;
|
goto err;
|
||||||
}
|
|
||||||
list_add_tail(&rxbuf->list, &priv->rx.rxbuf);
|
list_add_tail(&rxbuf->list, &priv->rx.rxbuf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2981,13 +2981,8 @@ struct ath_gen_timer *ath_gen_timer_alloc(struct ath_hw *ah,
|
||||||
struct ath_gen_timer *timer;
|
struct ath_gen_timer *timer;
|
||||||
|
|
||||||
timer = kzalloc(sizeof(struct ath_gen_timer), GFP_KERNEL);
|
timer = kzalloc(sizeof(struct ath_gen_timer), GFP_KERNEL);
|
||||||
|
if (timer == NULL)
|
||||||
if (timer == NULL) {
|
|
||||||
ath_err(ath9k_hw_common(ah),
|
|
||||||
"Failed to allocate memory for hw timer[%d]\n",
|
|
||||||
timer_index);
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
|
||||||
|
|
||||||
/* allocate a hardware generic timer slot */
|
/* allocate a hardware generic timer slot */
|
||||||
timer_table->timers[timer_index] = timer;
|
timer_table->timers[timer_index] = timer;
|
||||||
|
|
|
@ -1452,17 +1452,7 @@ static void ath_rate_free(void *priv)
|
||||||
|
|
||||||
static void *ath_rate_alloc_sta(void *priv, struct ieee80211_sta *sta, gfp_t gfp)
|
static void *ath_rate_alloc_sta(void *priv, struct ieee80211_sta *sta, gfp_t gfp)
|
||||||
{
|
{
|
||||||
struct ath_softc *sc = priv;
|
return kzalloc(sizeof(struct ath_rate_priv), gfp);
|
||||||
struct ath_rate_priv *rate_priv;
|
|
||||||
|
|
||||||
rate_priv = kzalloc(sizeof(struct ath_rate_priv), gfp);
|
|
||||||
if (!rate_priv) {
|
|
||||||
ath_err(ath9k_hw_common(sc->sc_ah),
|
|
||||||
"Unable to allocate private rc structure\n");
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
return rate_priv;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ath_rate_free_sta(void *priv, struct ieee80211_sta *sta,
|
static void ath_rate_free_sta(void *priv, struct ieee80211_sta *sta,
|
||||||
|
|
|
@ -74,8 +74,6 @@ static int wil_vring_alloc(struct wil6210_priv *wil, struct vring *vring)
|
||||||
vring->swtail = 0;
|
vring->swtail = 0;
|
||||||
vring->ctx = kzalloc(vring->size * sizeof(vring->ctx[0]), GFP_KERNEL);
|
vring->ctx = kzalloc(vring->size * sizeof(vring->ctx[0]), GFP_KERNEL);
|
||||||
if (!vring->ctx) {
|
if (!vring->ctx) {
|
||||||
wil_err(wil, "vring_alloc [%d] failed to alloc ctx mem\n",
|
|
||||||
vring->size);
|
|
||||||
vring->va = NULL;
|
vring->va = NULL;
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
|
|
|
@ -587,11 +587,9 @@ void wmi_recv_cmd(struct wil6210_priv *wil)
|
||||||
evt = kmalloc(ALIGN(offsetof(struct pending_wmi_event,
|
evt = kmalloc(ALIGN(offsetof(struct pending_wmi_event,
|
||||||
event.wmi) + len, 4),
|
event.wmi) + len, 4),
|
||||||
GFP_KERNEL);
|
GFP_KERNEL);
|
||||||
if (!evt) {
|
if (!evt)
|
||||||
wil_err(wil, "kmalloc for WMI event (%d) failed\n",
|
|
||||||
len);
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
evt->event.hdr = hdr;
|
evt->event.hdr = hdr;
|
||||||
cmd = (void *)&evt->event.wmi;
|
cmd = (void *)&evt->event.wmi;
|
||||||
wil_memcpy_fromio_32(cmd, src, len);
|
wil_memcpy_fromio_32(cmd, src, len);
|
||||||
|
@ -838,10 +836,8 @@ int wmi_set_ie(struct wil6210_priv *wil, u8 type, u16 ie_len, const void *ie)
|
||||||
int rc;
|
int rc;
|
||||||
u16 len = sizeof(struct wmi_set_appie_cmd) + ie_len;
|
u16 len = sizeof(struct wmi_set_appie_cmd) + ie_len;
|
||||||
struct wmi_set_appie_cmd *cmd = kzalloc(len, GFP_KERNEL);
|
struct wmi_set_appie_cmd *cmd = kzalloc(len, GFP_KERNEL);
|
||||||
if (!cmd) {
|
if (!cmd)
|
||||||
wil_err(wil, "kmalloc(%d) failed\n", len);
|
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
|
||||||
|
|
||||||
cmd->mgmt_frm_type = type;
|
cmd->mgmt_frm_type = type;
|
||||||
/* BUG: FW API define ieLen as u8. Will fix FW */
|
/* BUG: FW API define ieLen as u8. Will fix FW */
|
||||||
|
|
|
@ -1445,10 +1445,9 @@ brcmf_sdbrcm_read_control(struct brcmf_sdio *bus, u8 *hdr, uint len, uint doff)
|
||||||
|
|
||||||
if (bus->rxblen)
|
if (bus->rxblen)
|
||||||
buf = vzalloc(bus->rxblen);
|
buf = vzalloc(bus->rxblen);
|
||||||
if (!buf) {
|
if (!buf)
|
||||||
brcmf_err("no memory for control frame\n");
|
|
||||||
goto done;
|
goto done;
|
||||||
}
|
|
||||||
rbuf = bus->rxbuf;
|
rbuf = bus->rxbuf;
|
||||||
pad = ((unsigned long)rbuf % BRCMF_SDALIGN);
|
pad = ((unsigned long)rbuf % BRCMF_SDALIGN);
|
||||||
if (pad)
|
if (pad)
|
||||||
|
|
|
@ -354,11 +354,10 @@ brcmf_usbdev_qinit(struct list_head *q, int qsize)
|
||||||
int i;
|
int i;
|
||||||
struct brcmf_usbreq *req, *reqs;
|
struct brcmf_usbreq *req, *reqs;
|
||||||
|
|
||||||
reqs = kzalloc(sizeof(struct brcmf_usbreq) * qsize, GFP_ATOMIC);
|
reqs = kcalloc(qsize, sizeof(struct brcmf_usbreq), GFP_ATOMIC);
|
||||||
if (reqs == NULL) {
|
if (reqs == NULL)
|
||||||
brcmf_err("fail to allocate memory!\n");
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
|
||||||
req = reqs;
|
req = reqs;
|
||||||
|
|
||||||
for (i = 0; i < qsize; i++) {
|
for (i = 0; i < qsize; i++) {
|
||||||
|
|
|
@ -1149,7 +1149,6 @@ static int mwl8k_rxq_init(struct ieee80211_hw *hw, int index)
|
||||||
|
|
||||||
rxq->buf = kcalloc(MWL8K_RX_DESCS, sizeof(*rxq->buf), GFP_KERNEL);
|
rxq->buf = kcalloc(MWL8K_RX_DESCS, sizeof(*rxq->buf), GFP_KERNEL);
|
||||||
if (rxq->buf == NULL) {
|
if (rxq->buf == NULL) {
|
||||||
wiphy_err(hw->wiphy, "failed to alloc RX skbuff list\n");
|
|
||||||
pci_free_consistent(priv->pdev, size, rxq->rxd, rxq->rxd_dma);
|
pci_free_consistent(priv->pdev, size, rxq->rxd, rxq->rxd_dma);
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
|
@ -1442,7 +1441,6 @@ static int mwl8k_txq_init(struct ieee80211_hw *hw, int index)
|
||||||
|
|
||||||
txq->skb = kcalloc(MWL8K_TX_DESCS, sizeof(*txq->skb), GFP_KERNEL);
|
txq->skb = kcalloc(MWL8K_TX_DESCS, sizeof(*txq->skb), GFP_KERNEL);
|
||||||
if (txq->skb == NULL) {
|
if (txq->skb == NULL) {
|
||||||
wiphy_err(hw->wiphy, "failed to alloc TX skbuff list\n");
|
|
||||||
pci_free_consistent(priv->pdev, size, txq->txd, txq->txd_dma);
|
pci_free_consistent(priv->pdev, size, txq->txd, txq->txd_dma);
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue