Commit e404decb authored by Joe Perches's avatar Joe Perches Committed by David S. Miller
Browse files

drivers/net: Remove unnecessary k.alloc/v.alloc OOM messages



alloc failures use dump_stack so emitting an additional
out-of-memory message is an unnecessary duplication.

Remove the allocation failure messages.
Signed-off-by: default avatarJoe Perches <joe@perches.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 5f3d9cb2
...@@ -180,11 +180,9 @@ static int tlb_initialize(struct bonding *bond) ...@@ -180,11 +180,9 @@ static int tlb_initialize(struct bonding *bond)
int i; int i;
new_hashtbl = kzalloc(size, GFP_KERNEL); new_hashtbl = kzalloc(size, GFP_KERNEL);
if (!new_hashtbl) { if (!new_hashtbl)
pr_err("%s: Error: Failed to allocate TLB hash table\n",
bond->dev->name);
return -1; return -1;
}
_lock_tx_hashtbl_bh(bond); _lock_tx_hashtbl_bh(bond);
bond_info->tx_hashtbl = new_hashtbl; bond_info->tx_hashtbl = new_hashtbl;
...@@ -784,11 +782,9 @@ static int rlb_initialize(struct bonding *bond) ...@@ -784,11 +782,9 @@ static int rlb_initialize(struct bonding *bond)
int i; int i;
new_hashtbl = kmalloc(size, GFP_KERNEL); new_hashtbl = kmalloc(size, GFP_KERNEL);
if (!new_hashtbl) { if (!new_hashtbl)
pr_err("%s: Error: Failed to allocate RLB hash table\n",
bond->dev->name);
return -1; return -1;
}
_lock_rx_hashtbl_bh(bond); _lock_rx_hashtbl_bh(bond);
bond_info->rx_hashtbl = new_hashtbl; bond_info->rx_hashtbl = new_hashtbl;
......
...@@ -639,10 +639,8 @@ static int __init slcan_init(void) ...@@ -639,10 +639,8 @@ static int __init slcan_init(void)
printk(KERN_INFO "slcan: %d dynamic interface channels.\n", maxdev); printk(KERN_INFO "slcan: %d dynamic interface channels.\n", maxdev);
slcan_devs = kzalloc(sizeof(struct net_device *)*maxdev, GFP_KERNEL); slcan_devs = kzalloc(sizeof(struct net_device *)*maxdev, GFP_KERNEL);
if (!slcan_devs) { if (!slcan_devs)
printk(KERN_ERR "slcan: can't allocate slcan device array!\n");
return -ENOMEM; return -ENOMEM;
}
/* Fill in our line protocol discipline, and register it */ /* Fill in our line protocol discipline, and register it */
status = tty_register_ldisc(N_SLCAN, &slc_ldisc); status = tty_register_ldisc(N_SLCAN, &slc_ldisc);
......
...@@ -621,10 +621,8 @@ static void *ni65_alloc_mem(struct net_device *dev,char *what,int size,int type) ...@@ -621,10 +621,8 @@ static void *ni65_alloc_mem(struct net_device *dev,char *what,int size,int type)
} }
else { else {
ret = ptr = kmalloc(T_BUF_SIZE,GFP_KERNEL | GFP_DMA); ret = ptr = kmalloc(T_BUF_SIZE,GFP_KERNEL | GFP_DMA);
if(!ret) { if(!ret)
printk(KERN_WARNING "%s: unable to allocate %s memory.\n",dev->name,what);
return NULL; return NULL;
}
} }
if( (u32) virt_to_phys(ptr+size) > 0x1000000) { if( (u32) virt_to_phys(ptr+size) > 0x1000000) {
printk(KERN_WARNING "%s: unable to allocate %s memory in lower 16MB!\n",dev->name,what); printk(KERN_WARNING "%s: unable to allocate %s memory in lower 16MB!\n",dev->name,what);
......
...@@ -1660,10 +1660,8 @@ static int __init bmac_init(void) ...@@ -1660,10 +1660,8 @@ static int __init bmac_init(void)
{ {
if (bmac_emergency_rxbuf == NULL) { if (bmac_emergency_rxbuf == NULL) {
bmac_emergency_rxbuf = kmalloc(RX_BUFLEN, GFP_KERNEL); bmac_emergency_rxbuf = kmalloc(RX_BUFLEN, GFP_KERNEL);
if (bmac_emergency_rxbuf == NULL) { if (bmac_emergency_rxbuf == NULL)
printk(KERN_ERR "BMAC: can't allocate emergency RX buffer\n");
return -ENOMEM; return -ENOMEM;
}
} }
return macio_register_driver(&bmac_driver); return macio_register_driver(&bmac_driver);
......
...@@ -136,10 +136,8 @@ static int __devinit mace_probe(struct macio_dev *mdev, const struct of_device_i ...@@ -136,10 +136,8 @@ static int __devinit mace_probe(struct macio_dev *mdev, const struct of_device_i
*/ */
if (dummy_buf == NULL) { if (dummy_buf == NULL) {
dummy_buf = kmalloc(RX_BUFLEN+2, GFP_KERNEL); dummy_buf = kmalloc(RX_BUFLEN+2, GFP_KERNEL);
if (dummy_buf == NULL) { if (dummy_buf == NULL)
printk(KERN_ERR "MACE: couldn't allocate dummy buffer\n");
return -ENOMEM; return -ENOMEM;
}
} }
if (macio_request_resources(mdev, "mace")) { if (macio_request_resources(mdev, "mace")) {
......
...@@ -2625,10 +2625,8 @@ bnx2_alloc_bad_rbuf(struct bnx2 *bp) ...@@ -2625,10 +2625,8 @@ bnx2_alloc_bad_rbuf(struct bnx2 *bp)
u32 val; u32 val;
good_mbuf = kmalloc(512 * sizeof(u16), GFP_KERNEL); good_mbuf = kmalloc(512 * sizeof(u16), GFP_KERNEL);
if (good_mbuf == NULL) { if (good_mbuf == NULL)
pr_err("Failed to allocate memory in %s\n", __func__);
return -ENOMEM; return -ENOMEM;
}
REG_WR(bp, BNX2_MISC_ENABLE_SET_BITS, REG_WR(bp, BNX2_MISC_ENABLE_SET_BITS,
BNX2_MISC_ENABLE_SET_BITS_RX_MBUF_ENABLE); BNX2_MISC_ENABLE_SET_BITS_RX_MBUF_ENABLE);
......
...@@ -10894,10 +10894,8 @@ static inline void be16_to_cpu_n(const u8 *_source, u8 *_target, u32 n) ...@@ -10894,10 +10894,8 @@ static inline void be16_to_cpu_n(const u8 *_source, u8 *_target, u32 n)
do { \ do { \
u32 len = be32_to_cpu(fw_hdr->arr.len); \ u32 len = be32_to_cpu(fw_hdr->arr.len); \
bp->arr = kmalloc(len, GFP_KERNEL); \ bp->arr = kmalloc(len, GFP_KERNEL); \
if (!bp->arr) { \ if (!bp->arr) \
pr_err("Failed to allocate %d bytes for "#arr"\n", len); \
goto lbl; \ goto lbl; \
} \
func(bp->firmware->data + be32_to_cpu(fw_hdr->arr.offset), \ func(bp->firmware->data + be32_to_cpu(fw_hdr->arr.offset), \
(u8 *)bp->arr, len); \ (u8 *)bp->arr, len); \
} while (0) } while (0)
......
...@@ -62,8 +62,6 @@ bnad_debugfs_open_fwtrc(struct inode *inode, struct file *file) ...@@ -62,8 +62,6 @@ bnad_debugfs_open_fwtrc(struct inode *inode, struct file *file)
if (!fw_debug->debug_buffer) { if (!fw_debug->debug_buffer) {
kfree(fw_debug); kfree(fw_debug);
fw_debug = NULL; fw_debug = NULL;
pr_warn("bna %s: Failed to allocate fwtrc buffer\n",
pci_name(bnad->pcidev));
return -ENOMEM; return -ENOMEM;
} }
...@@ -105,8 +103,6 @@ bnad_debugfs_open_fwsave(struct inode *inode, struct file *file) ...@@ -105,8 +103,6 @@ bnad_debugfs_open_fwsave(struct inode *inode, struct file *file)
if (!fw_debug->debug_buffer) { if (!fw_debug->debug_buffer) {
kfree(fw_debug); kfree(fw_debug);
fw_debug = NULL; fw_debug = NULL;
pr_warn("bna %s: Failed to allocate fwsave buffer\n",
pci_name(bnad->pcidev));
return -ENOMEM; return -ENOMEM;
} }
...@@ -208,8 +204,6 @@ bnad_debugfs_open_drvinfo(struct inode *inode, struct file *file) ...@@ -208,8 +204,6 @@ bnad_debugfs_open_drvinfo(struct inode *inode, struct file *file)
if (!drv_info->debug_buffer) { if (!drv_info->debug_buffer) {
kfree(drv_info); kfree(drv_info);
drv_info = NULL; drv_info = NULL;
pr_warn("bna %s: Failed to allocate drv info buffer\n",
pci_name(bnad->pcidev));
return -ENOMEM; return -ENOMEM;
} }
...@@ -348,11 +342,8 @@ bnad_debugfs_write_regrd(struct file *file, const char __user *buf, ...@@ -348,11 +342,8 @@ bnad_debugfs_write_regrd(struct file *file, const char __user *buf,
/* Allocate memory to store the user space buf */ /* Allocate memory to store the user space buf */
kern_buf = kzalloc(nbytes, GFP_KERNEL); kern_buf = kzalloc(nbytes, GFP_KERNEL);
if (!kern_buf) { if (!kern_buf)
pr_warn("bna %s: Failed to allocate user buffer\n",
pci_name(bnad->pcidev));
return -ENOMEM; return -ENOMEM;
}
if (copy_from_user(kern_buf, (void __user *)buf, nbytes)) { if (copy_from_user(kern_buf, (void __user *)buf, nbytes)) {
kfree(kern_buf); kfree(kern_buf);
...@@ -373,11 +364,8 @@ bnad_debugfs_write_regrd(struct file *file, const char __user *buf, ...@@ -373,11 +364,8 @@ bnad_debugfs_write_regrd(struct file *file, const char __user *buf,
bnad->reglen = 0; bnad->reglen = 0;
bnad->regdata = kzalloc(len << 2, GFP_KERNEL); bnad->regdata = kzalloc(len << 2, GFP_KERNEL);
if (!bnad->regdata) { if (!bnad->regdata)
pr_warn("bna %s: Failed to allocate regrd buffer\n",
pci_name(bnad->pcidev));
return -ENOMEM; return -ENOMEM;
}
bnad->reglen = len << 2; bnad->reglen = len << 2;
rb = bfa_ioc_bar0(ioc); rb = bfa_ioc_bar0(ioc);
...@@ -421,11 +409,8 @@ bnad_debugfs_write_regwr(struct file *file, const char __user *buf, ...@@ -421,11 +409,8 @@ bnad_debugfs_write_regwr(struct file *file, const char __user *buf,
/* Allocate memory to store the user space buf */ /* Allocate memory to store the user space buf */
kern_buf = kzalloc(nbytes, GFP_KERNEL); kern_buf = kzalloc(nbytes, GFP_KERNEL);
if (!kern_buf) { if (!kern_buf)
pr_warn("bna %s: Failed to allocate user buffer\n",
pci_name(bnad->pcidev));
return -ENOMEM; return -ENOMEM;
}
if (copy_from_user(kern_buf, (void __user *)buf, nbytes)) { if (copy_from_user(kern_buf, (void __user *)buf, nbytes)) {
kfree(kern_buf); kfree(kern_buf);
......
...@@ -2388,7 +2388,6 @@ static int __devinit enic_probe(struct pci_dev *pdev, ...@@ -2388,7 +2388,6 @@ static int __devinit enic_probe(struct pci_dev *pdev,
/* Allocate structure for port profiles */ /* Allocate structure for port profiles */
enic->pp = kcalloc(num_pps, sizeof(*enic->pp), GFP_KERNEL); enic->pp = kcalloc(num_pps, sizeof(*enic->pp), GFP_KERNEL);
if (!enic->pp) { if (!enic->pp) {
pr_err("port profile alloc failed, aborting\n");
err = -ENOMEM; err = -ENOMEM;
goto err_out_disable_sriov_pp; goto err_out_disable_sriov_pp;
} }
......
...@@ -38,10 +38,8 @@ static int vnic_rq_alloc_bufs(struct vnic_rq *rq) ...@@ -38,10 +38,8 @@ static int vnic_rq_alloc_bufs(struct vnic_rq *rq)
for (i = 0; i < blks; i++) { for (i = 0; i < blks; i++) {
rq->bufs[i] = kzalloc(VNIC_RQ_BUF_BLK_SZ(count), GFP_ATOMIC); rq->bufs[i] = kzalloc(VNIC_RQ_BUF_BLK_SZ(count), GFP_ATOMIC);
if (!rq->bufs[i]) { if (!rq->bufs[i])
pr_err("Failed to alloc rq_bufs\n");
return -ENOMEM; return -ENOMEM;
}
} }
for (i = 0; i < blks; i++) { for (i = 0; i < blks; i++) {
......
...@@ -38,10 +38,8 @@ static int vnic_wq_alloc_bufs(struct vnic_wq *wq) ...@@ -38,10 +38,8 @@ static int vnic_wq_alloc_bufs(struct vnic_wq *wq)
for (i = 0; i < blks; i++) { for (i = 0; i < blks; i++) {
wq->bufs[i] = kzalloc(VNIC_WQ_BUF_BLK_SZ(count), GFP_ATOMIC); wq->bufs[i] = kzalloc(VNIC_WQ_BUF_BLK_SZ(count), GFP_ATOMIC);
if (!wq->bufs[i]) { if (!wq->bufs[i])
pr_err("Failed to alloc wq_bufs\n");
return -ENOMEM; return -ENOMEM;
}
} }
for (i = 0; i < blks; i++) { for (i = 0; i < blks; i++) {
......
...@@ -454,8 +454,6 @@ init_rx_bufs(struct net_device *dev, int num) { ...@@ -454,8 +454,6 @@ init_rx_bufs(struct net_device *dev, int num) {
} }
rfd->rbd = rbd; rfd->rbd = rbd;
} else {
printk("Could not kmalloc rbd\n");
} }
} }
lp->rbd_tail->next = rfd->rbd; lp->rbd_tail->next = rfd->rbd;
......
...@@ -237,11 +237,8 @@ static int __devinit rgmii_probe(struct platform_device *ofdev) ...@@ -237,11 +237,8 @@ static int __devinit rgmii_probe(struct platform_device *ofdev)
rc = -ENOMEM; rc = -ENOMEM;
dev = kzalloc(sizeof(struct rgmii_instance), GFP_KERNEL); dev = kzalloc(sizeof(struct rgmii_instance), GFP_KERNEL);
if (dev == NULL) { if (dev == NULL)
printk(KERN_ERR "%s: could not allocate RGMII device!\n",
np->full_name);
goto err_gone; goto err_gone;
}
mutex_init(&dev->lock); mutex_init(&dev->lock);
dev->ofdev = ofdev; dev->ofdev = ofdev;
......
...@@ -96,11 +96,8 @@ static int __devinit tah_probe(struct platform_device *ofdev) ...@@ -96,11 +96,8 @@ static int __devinit tah_probe(struct platform_device *ofdev)
rc = -ENOMEM; rc = -ENOMEM;
dev = kzalloc(sizeof(struct tah_instance), GFP_KERNEL); dev = kzalloc(sizeof(struct tah_instance), GFP_KERNEL);
if (dev == NULL) { if (dev == NULL)
printk(KERN_ERR "%s: could not allocate TAH device!\n",
np->full_name);
goto err_gone; goto err_gone;
}
mutex_init(&dev->lock); mutex_init(&dev->lock);
dev->ofdev = ofdev; dev->ofdev = ofdev;
......
...@@ -240,11 +240,8 @@ static int __devinit zmii_probe(struct platform_device *ofdev) ...@@ -240,11 +240,8 @@ static int __devinit zmii_probe(struct platform_device *ofdev)
rc = -ENOMEM; rc = -ENOMEM;
dev = kzalloc(sizeof(struct zmii_instance), GFP_KERNEL); dev = kzalloc(sizeof(struct zmii_instance), GFP_KERNEL);
if (dev == NULL) { if (dev == NULL)
printk(KERN_ERR "%s: could not allocate ZMII device!\n",
np->full_name);
goto err_gone; goto err_gone;
}
mutex_init(&dev->lock); mutex_init(&dev->lock);
dev->ofdev = ofdev; dev->ofdev = ofdev;
......
...@@ -730,10 +730,8 @@ static void e1000_dump_eeprom(struct e1000_adapter *adapter) ...@@ -730,10 +730,8 @@ static void e1000_dump_eeprom(struct e1000_adapter *adapter)
eeprom.offset = 0; eeprom.offset = 0;
data = kmalloc(eeprom.len, GFP_KERNEL); data = kmalloc(eeprom.len, GFP_KERNEL);
if (!data) { if (!data)
pr_err("Unable to allocate memory to dump EEPROM data\n");
return; return;
}
ops->get_eeprom(netdev, &eeprom, data); ops->get_eeprom(netdev, &eeprom, data);
......
...@@ -1136,10 +1136,8 @@ ixgb_set_multi(struct net_device *netdev) ...@@ -1136,10 +1136,8 @@ ixgb_set_multi(struct net_device *netdev)
u8 *mta = kmalloc(IXGB_MAX_NUM_MULTICAST_ADDRESSES * u8 *mta = kmalloc(IXGB_MAX_NUM_MULTICAST_ADDRESSES *
ETH_ALEN, GFP_ATOMIC); ETH_ALEN, GFP_ATOMIC);
u8 *addr; u8 *addr;
if (!mta) { if (!mta)
pr_err("allocation of multicast memory failed\n");
goto alloc_failed; goto alloc_failed;
}
IXGB_WRITE_REG(hw, RCTL, rctl); IXGB_WRITE_REG(hw, RCTL, rctl);
......
...@@ -2517,12 +2517,8 @@ int ixgbevf_setup_rx_resources(struct ixgbevf_adapter *adapter, ...@@ -2517,12 +2517,8 @@ int ixgbevf_setup_rx_resources(struct ixgbevf_adapter *adapter,
size = sizeof(struct ixgbevf_rx_buffer) * rx_ring->count; size = sizeof(struct ixgbevf_rx_buffer) * rx_ring->count;
rx_ring->rx_buffer_info = vzalloc(size); rx_ring->rx_buffer_info = vzalloc(size);
if (!rx_ring->rx_buffer_info) { if (!rx_ring->rx_buffer_info)
hw_dbg(&adapter->hw,
"Unable to vmalloc buffer memory for "
"the receive descriptor ring\n");
goto alloc_failed; goto alloc_failed;
}
/* Round up to nearest 4K */ /* Round up to nearest 4K */
rx_ring->size = rx_ring->count * sizeof(union ixgbe_adv_rx_desc); rx_ring->size = rx_ring->count * sizeof(union ixgbe_adv_rx_desc);
......
...@@ -1150,7 +1150,6 @@ static int korina_probe(struct platform_device *pdev) ...@@ -1150,7 +1150,6 @@ static int korina_probe(struct platform_device *pdev)
lp->td_ring = kmalloc(TD_RING_SIZE + RD_RING_SIZE, GFP_KERNEL); lp->td_ring = kmalloc(TD_RING_SIZE + RD_RING_SIZE, GFP_KERNEL);
if (!lp->td_ring) { if (!lp->td_ring) {
printk(KERN_ERR DRV_NAME ": cannot allocate descriptors\n");
rc = -ENXIO; rc = -ENXIO;
goto probe_err_td_ring; goto probe_err_td_ring;
} }
......
...@@ -1017,10 +1017,9 @@ static int rxq_init(struct net_device *dev) ...@@ -1017,10 +1017,9 @@ static int rxq_init(struct net_device *dev)
/* Allocate RX skb rings */ /* Allocate RX skb rings */
pep->rx_skb = kmalloc(sizeof(*pep->rx_skb) * pep->rx_ring_size, pep->rx_skb = kmalloc(sizeof(*pep->rx_skb) * pep->rx_ring_size,
GFP_KERNEL); GFP_KERNEL);
if (!pep->rx_skb) { if (!pep->rx_skb)
printk(KERN_ERR "%s: Cannot alloc RX skb ring\n", dev->name);
return -ENOMEM; return -ENOMEM;
}
/* Allocate RX ring */ /* Allocate RX ring */
pep->rx_desc_count = 0; pep->rx_desc_count = 0;
size = pep->rx_ring_size * sizeof(struct rx_desc); size = pep->rx_ring_size * sizeof(struct rx_desc);
...@@ -1081,10 +1080,9 @@ static int txq_init(struct net_device *dev) ...@@ -1081,10 +1080,9 @@ static int txq_init(struct net_device *dev)
pep->tx_skb = kmalloc(sizeof(*pep->tx_skb) * pep->tx_ring_size, pep->tx_skb = kmalloc(sizeof(*pep->tx_skb) * pep->tx_ring_size,
GFP_KERNEL); GFP_KERNEL);
if (!pep->tx_skb) { if (!pep->tx_skb)
printk(KERN_ERR "%s: Cannot alloc TX skb ring\n", dev->name);
return -ENOMEM; return -ENOMEM;
}
/* Allocate TX ring */ /* Allocate TX ring */
pep->tx_desc_count = 0; pep->tx_desc_count = 0;
size = pep->tx_ring_size * sizeof(struct tx_desc); size = pep->tx_ring_size * sizeof(struct tx_desc);
......
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