Skip to content

Commit e404dec

Browse files
JoePerchesdavem330
authored andcommitted
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: Joe Perches <joe@perches.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 5f3d9cb commit e404dec

60 files changed

Lines changed: 77 additions & 233 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎drivers/net/bonding/bond_alb.c‎

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -180,11 +180,9 @@ static int tlb_initialize(struct bonding *bond)
180180
int i;
181181

182182
new_hashtbl = kzalloc(size, GFP_KERNEL);
183-
if (!new_hashtbl) {
184-
pr_err("%s: Error: Failed to allocate TLB hash table\n",
185-
bond->dev->name);
183+
if (!new_hashtbl)
186184
return -1;
187-
}
185+
188186
_lock_tx_hashtbl_bh(bond);
189187

190188
bond_info->tx_hashtbl = new_hashtbl;
@@ -784,11 +782,9 @@ static int rlb_initialize(struct bonding *bond)
784782
int i;
785783

786784
new_hashtbl = kmalloc(size, GFP_KERNEL);
787-
if (!new_hashtbl) {
788-
pr_err("%s: Error: Failed to allocate RLB hash table\n",
789-
bond->dev->name);
785+
if (!new_hashtbl)
790786
return -1;
791-
}
787+
792788
_lock_rx_hashtbl_bh(bond);
793789

794790
bond_info->rx_hashtbl = new_hashtbl;

‎drivers/net/can/slcan.c‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -639,10 +639,8 @@ static int __init slcan_init(void)
639639
printk(KERN_INFO "slcan: %d dynamic interface channels.\n", maxdev);
640640

641641
slcan_devs = kzalloc(sizeof(struct net_device *)*maxdev, GFP_KERNEL);
642-
if (!slcan_devs) {
643-
printk(KERN_ERR "slcan: can't allocate slcan device array!\n");
642+
if (!slcan_devs)
644643
return -ENOMEM;
645-
}
646644

647645
/* Fill in our line protocol discipline, and register it */
648646
status = tty_register_ldisc(N_SLCAN, &slc_ldisc);

‎drivers/net/ethernet/amd/ni65.c‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -621,10 +621,8 @@ static void *ni65_alloc_mem(struct net_device *dev,char *what,int size,int type)
621621
}
622622
else {
623623
ret = ptr = kmalloc(T_BUF_SIZE,GFP_KERNEL | GFP_DMA);
624-
if(!ret) {
625-
printk(KERN_WARNING "%s: unable to allocate %s memory.\n",dev->name,what);
624+
if(!ret)
626625
return NULL;
627-
}
628626
}
629627
if( (u32) virt_to_phys(ptr+size) > 0x1000000) {
630628
printk(KERN_WARNING "%s: unable to allocate %s memory in lower 16MB!\n",dev->name,what);

‎drivers/net/ethernet/apple/bmac.c‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1660,10 +1660,8 @@ static int __init bmac_init(void)
16601660
{
16611661
if (bmac_emergency_rxbuf == NULL) {
16621662
bmac_emergency_rxbuf = kmalloc(RX_BUFLEN, GFP_KERNEL);
1663-
if (bmac_emergency_rxbuf == NULL) {
1664-
printk(KERN_ERR "BMAC: can't allocate emergency RX buffer\n");
1663+
if (bmac_emergency_rxbuf == NULL)
16651664
return -ENOMEM;
1666-
}
16671665
}
16681666

16691667
return macio_register_driver(&bmac_driver);

‎drivers/net/ethernet/apple/mace.c‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -136,10 +136,8 @@ static int __devinit mace_probe(struct macio_dev *mdev, const struct of_device_i
136136
*/
137137
if (dummy_buf == NULL) {
138138
dummy_buf = kmalloc(RX_BUFLEN+2, GFP_KERNEL);
139-
if (dummy_buf == NULL) {
140-
printk(KERN_ERR "MACE: couldn't allocate dummy buffer\n");
139+
if (dummy_buf == NULL)
141140
return -ENOMEM;
142-
}
143141
}
144142

145143
if (macio_request_resources(mdev, "mace")) {

‎drivers/net/ethernet/broadcom/bnx2.c‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2625,10 +2625,8 @@ bnx2_alloc_bad_rbuf(struct bnx2 *bp)
26252625
u32 val;
26262626

26272627
good_mbuf = kmalloc(512 * sizeof(u16), GFP_KERNEL);
2628-
if (good_mbuf == NULL) {
2629-
pr_err("Failed to allocate memory in %s\n", __func__);
2628+
if (good_mbuf == NULL)
26302629
return -ENOMEM;
2631-
}
26322630

26332631
REG_WR(bp, BNX2_MISC_ENABLE_SET_BITS,
26342632
BNX2_MISC_ENABLE_SET_BITS_RX_MBUF_ENABLE);

‎drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10894,10 +10894,8 @@ static inline void be16_to_cpu_n(const u8 *_source, u8 *_target, u32 n)
1089410894
do { \
1089510895
u32 len = be32_to_cpu(fw_hdr->arr.len); \
1089610896
bp->arr = kmalloc(len, GFP_KERNEL); \
10897-
if (!bp->arr) { \
10898-
pr_err("Failed to allocate %d bytes for "#arr"\n", len); \
10897+
if (!bp->arr) \
1089910898
goto lbl; \
10900-
} \
1090110899
func(bp->firmware->data + be32_to_cpu(fw_hdr->arr.offset), \
1090210900
(u8 *)bp->arr, len); \
1090310901
} while (0)

‎drivers/net/ethernet/brocade/bna/bnad_debugfs.c‎

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,6 @@ bnad_debugfs_open_fwtrc(struct inode *inode, struct file *file)
6262
if (!fw_debug->debug_buffer) {
6363
kfree(fw_debug);
6464
fw_debug = NULL;
65-
pr_warn("bna %s: Failed to allocate fwtrc buffer\n",
66-
pci_name(bnad->pcidev));
6765
return -ENOMEM;
6866
}
6967

@@ -105,8 +103,6 @@ bnad_debugfs_open_fwsave(struct inode *inode, struct file *file)
105103
if (!fw_debug->debug_buffer) {
106104
kfree(fw_debug);
107105
fw_debug = NULL;
108-
pr_warn("bna %s: Failed to allocate fwsave buffer\n",
109-
pci_name(bnad->pcidev));
110106
return -ENOMEM;
111107
}
112108

@@ -208,8 +204,6 @@ bnad_debugfs_open_drvinfo(struct inode *inode, struct file *file)
208204
if (!drv_info->debug_buffer) {
209205
kfree(drv_info);
210206
drv_info = NULL;
211-
pr_warn("bna %s: Failed to allocate drv info buffer\n",
212-
pci_name(bnad->pcidev));
213207
return -ENOMEM;
214208
}
215209

@@ -348,11 +342,8 @@ bnad_debugfs_write_regrd(struct file *file, const char __user *buf,
348342

349343
/* Allocate memory to store the user space buf */
350344
kern_buf = kzalloc(nbytes, GFP_KERNEL);
351-
if (!kern_buf) {
352-
pr_warn("bna %s: Failed to allocate user buffer\n",
353-
pci_name(bnad->pcidev));
345+
if (!kern_buf)
354346
return -ENOMEM;
355-
}
356347

357348
if (copy_from_user(kern_buf, (void __user *)buf, nbytes)) {
358349
kfree(kern_buf);
@@ -373,11 +364,8 @@ bnad_debugfs_write_regrd(struct file *file, const char __user *buf,
373364
bnad->reglen = 0;
374365

375366
bnad->regdata = kzalloc(len << 2, GFP_KERNEL);
376-
if (!bnad->regdata) {
377-
pr_warn("bna %s: Failed to allocate regrd buffer\n",
378-
pci_name(bnad->pcidev));
367+
if (!bnad->regdata)
379368
return -ENOMEM;
380-
}
381369

382370
bnad->reglen = len << 2;
383371
rb = bfa_ioc_bar0(ioc);
@@ -421,11 +409,8 @@ bnad_debugfs_write_regwr(struct file *file, const char __user *buf,
421409

422410
/* Allocate memory to store the user space buf */
423411
kern_buf = kzalloc(nbytes, GFP_KERNEL);
424-
if (!kern_buf) {
425-
pr_warn("bna %s: Failed to allocate user buffer\n",
426-
pci_name(bnad->pcidev));
412+
if (!kern_buf)
427413
return -ENOMEM;
428-
}
429414

430415
if (copy_from_user(kern_buf, (void __user *)buf, nbytes)) {
431416
kfree(kern_buf);

‎drivers/net/ethernet/cisco/enic/enic_main.c‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2388,7 +2388,6 @@ static int __devinit enic_probe(struct pci_dev *pdev,
23882388
/* Allocate structure for port profiles */
23892389
enic->pp = kcalloc(num_pps, sizeof(*enic->pp), GFP_KERNEL);
23902390
if (!enic->pp) {
2391-
pr_err("port profile alloc failed, aborting\n");
23922391
err = -ENOMEM;
23932392
goto err_out_disable_sriov_pp;
23942393
}

‎drivers/net/ethernet/cisco/enic/vnic_rq.c‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,8 @@ static int vnic_rq_alloc_bufs(struct vnic_rq *rq)
3838

3939
for (i = 0; i < blks; i++) {
4040
rq->bufs[i] = kzalloc(VNIC_RQ_BUF_BLK_SZ(count), GFP_ATOMIC);
41-
if (!rq->bufs[i]) {
42-
pr_err("Failed to alloc rq_bufs\n");
41+
if (!rq->bufs[i])
4342
return -ENOMEM;
44-
}
4543
}
4644

4745
for (i = 0; i < blks; i++) {

0 commit comments

Comments
 (0)