drivers/net: Remove unnecessary k.alloc/v.alloc OOM messages
Subsystems (59)
PATCH 1/1 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.
---
Let me know if this should be broken into multiple patches. Generated -U4 to be able to see more of the alloc calls. Compiled tested x86 only.
drivers/net/bonding/bond_alb.c | 12 +++------- drivers/net/can/slcan.c | 4 +-- drivers/net/ethernet/amd/ni65.c | 4 +-- drivers/net/ethernet/apple/bmac.c | 4 +-- drivers/net/ethernet/apple/mace.c | 4 +-- drivers/net/ethernet/broadcom/bnx2.c | 4 +-- drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c | 4 +-- drivers/net/ethernet/brocade/bna/bnad_debugfs.c | 21 ++----------------- drivers/net/ethernet/cisco/enic/enic_main.c | 1 - drivers/net/ethernet/cisco/enic/vnic_rq.c | 4 +-- drivers/net/ethernet/cisco/enic/vnic_wq.c | 4 +-- drivers/net/ethernet/i825xx/lp486e.c | 2 - drivers/net/ethernet/ibm/emac/rgmii.c | 5 +--- drivers/net/ethernet/ibm/emac/tah.c | 5 +--- drivers/net/ethernet/ibm/emac/zmii.c | 5 +--- drivers/net/ethernet/intel/e1000/e1000_main.c | 4 +-- drivers/net/ethernet/intel/ixgb/ixgb_main.c | 4 +-- drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c | 6 +---- drivers/net/ethernet/korina.c | 1 - drivers/net/ethernet/marvell/pxa168_eth.c | 10 +++----- drivers/net/ethernet/mellanox/mlx4/en_rx.c | 5 +-- drivers/net/ethernet/mellanox/mlx4/en_tx.c | 6 +--- drivers/net/ethernet/micrel/ks8851_mll.c | 4 +-- .../net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c | 9 ++----- .../net/ethernet/qlogic/netxen/netxen_nic_init.c | 12 ++-------- drivers/net/ethernet/qlogic/qlge/qlge_dbg.c | 4 +-- drivers/net/ethernet/sis/sis900.c | 1 - drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 5 +-- drivers/net/ethernet/sun/cassini.c | 1 - drivers/net/ethernet/sun/sunvnet.c | 9 ++----- drivers/net/ethernet/toshiba/ps3_gelic_wireless.c | 5 +-- drivers/net/hamradio/yam.c | 1 - drivers/net/hippi/rrunner.c | 8 +------ drivers/net/irda/donauboe.c | 2 - drivers/net/netconsole.c | 8 +----- drivers/net/ppp/pptp.c | 4 +-- drivers/net/slip/slip.c | 4 +-- drivers/net/tokenring/3c359.c | 4 --- drivers/net/tokenring/madgemc.c | 1 - drivers/net/vmxnet3/vmxnet3_drv.c | 15 ++----------- drivers/net/wan/c101.c | 4 +-- drivers/net/wan/dscc4.c | 8 +----- drivers/net/wan/lmc/lmc_main.c | 1 - drivers/net/wan/n2.c | 4 +-- drivers/net/wan/pc300too.c | 1 - drivers/net/wan/pci200syn.c | 1 - drivers/net/wan/wanxl.c | 1 - drivers/net/wan/x25_asy.c | 4 +-- drivers/net/wireless/ath/ath9k/htc_hst.c | 5 +--- drivers/net/wireless/hostap/hostap_hw.c | 18 +++++----------- drivers/net/wireless/ipw2x00/ipw2100.c | 5 +--- drivers/net/wireless/libertas/if_cs.c | 5 +-- drivers/net/wireless/libertas/if_usb.c | 4 +-- drivers/net/wireless/libertas_tf/if_usb.c | 4 +-- drivers/net/wireless/mwifiex/pcie.c | 4 +-- drivers/net/wireless/mwifiex/sdio.c | 4 +-- drivers/net/wireless/orinoco/main.c | 6 +--- drivers/net/wireless/prism54/islpci_mgt.c | 6 +--- drivers/net/wireless/rtlwifi/rtl8192ce/sw.c | 5 +--- drivers/net/wireless/rtlwifi/rtl8192cu/sw.c | 6 +--- drivers/net/wireless/rtlwifi/rtl8192de/sw.c | 5 +--- drivers/net/wireless/rtlwifi/rtl8192se/sw.c | 5 +--- drivers/net/xen-netback/netback.c | 4 +-- 63 files changed, 81 insertions(+), 245 deletions(-)
drivers/net/bonding/bond_alb.c +4 -8
@@ -179,13 +179,11 @@ static int tlb_initialize(struct bonding *bond)struct tlb_client_info *new_hashtbl;int i; new_hashtbl =kzalloc (size,GFP_KERNEL ); -if (!new_hashtbl) { -pr_err ("%s: Error: Failed to allocate TLB hash table\n" , - bond->dev->name); +if (!new_hashtbl)return -1 ; - } +_lock_tx_hashtbl_bh (bond); bond_info->tx_hashtbl = new_hashtbl;
@@ -783,13 +781,11 @@ static int rlb_initialize(struct bonding *bond)int size =RLB_HASH_TABLE_SIZE *sizeof (struct rlb_client_info );int i; new_hashtbl =kmalloc (size,GFP_KERNEL ); -if (!new_hashtbl) { -pr_err ("%s: Error: Failed to allocate RLB hash table\n" , - bond->dev->name); +if (!new_hashtbl)return -1 ; - } +_lock_rx_hashtbl_bh (bond); bond_info->rx_hashtbl = new_hashtbl;
drivers/net/can/slcan.c +1 -3
@@ -638,12 +638,10 @@ static int __init slcan_init(void)printk (banner);printk (KERN_INFO "slcan: %d dynamic interface channels.\n" , maxdev); slcan_devs =kzalloc (sizeof (struct net_device *)*maxdev,GFP_KERNEL ); -if (!slcan_devs) { -printk (KERN_ERR "slcan: can't allocate slcan device array!\n" ); +if (!slcan_devs)return -ENOMEM ; - }/* Fill in our line protocol discipline, and register it */ status =tty_register_ldisc (N_SLCAN , &slc_ldisc);if (status) {
drivers/net/ethernet/amd/ni65.c +1 -3
@@ -620,12 +620,10 @@ static void *ni65_alloc_mem(struct net_device *dev,char *what,int size,int type) ptr = skb->data; }else { ret = ptr =kmalloc (T_BUF_SIZE ,GFP_KERNEL |GFP_DMA ); -if (!ret) { -printk (KERN_WARNING "%s: unable to allocate %s memory.\n" ,dev->name,what); +if (!ret)return NULL ; - } }if ( (u32 )virt_to_phys (ptr+size) >0x1000000 ) {printk (KERN_WARNING "%s: unable to allocate %s memory in lower 16MB!\n" ,dev->name,what);if (type)
drivers/net/ethernet/apple/bmac.c +1 -3
@@ -1659,12 +1659,10 @@ static struct macio_driver bmac_driver =static int __init bmac_init (void ) {if (bmac_emergency_rxbuf ==NULL ) { bmac_emergency_rxbuf =kmalloc (RX_BUFLEN ,GFP_KERNEL ); -if (bmac_emergency_rxbuf ==NULL ) { -printk (KERN_ERR "BMAC: can't allocate emergency RX buffer\n" ); +if (bmac_emergency_rxbuf ==NULL )return -ENOMEM ; - } }return macio_register_driver (&bmac_driver); }
drivers/net/ethernet/apple/mace.c +1 -3
@@ -135,12 +135,10 @@ static int __devinit mace_probe(struct macio_dev *mdev, const struct of_device_i* never have more than one MACE in the system anyway) */ if (dummy_buf ==NULL ) { dummy_buf =kmalloc (RX_BUFLEN +2 ,GFP_KERNEL ); -if (dummy_buf ==NULL ) { -printk (KERN_ERR "MACE: couldn't allocate dummy buffer\n" ); +if (dummy_buf ==NULL )return -ENOMEM ; - } }if (macio_request_resources (mdev,"mace" )) {printk (KERN_ERR "MACE: can't request IO resources !\n" );
drivers/net/ethernet/broadcom/bnx2.c +1 -3
@@ -2624,12 +2624,10 @@ bnx2_alloc_bad_rbuf(struct bnx2 *bp)u32 good_mbuf_cnt;u32 val; good_mbuf =kmalloc (512 *sizeof (u16),GFP_KERNEL ); -if (good_mbuf ==NULL ) { -pr_err ("Failed to allocate memory in %s\n" , __func__); +if (good_mbuf ==NULL )return -ENOMEM ; - }REG_WR (bp,BNX2_MISC_ENABLE_SET_BITS ,BNX2_MISC_ENABLE_SET_BITS_RX_MBUF_ENABLE );
drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c +1 -3
@@ -10893,12 +10893,10 @@ static inline void be16_to_cpu_n(const u8 *_source, u8 *_target, u32 n)#define BNX2X_ALLOC_AND_SET (arr, lbl, func) \ do { \ u32 len = be32_to_cpu(fw_hdr->arr.len); \ bp->arr = kmalloc(len, GFP_KERNEL); \ - if (!bp->arr) { \ - pr_err("Failed to allocate %d bytes for "#arr"\n", len); \ + if (!bp->arr) \ goto lbl; \ - } \ func(bp->firmware->data + be32_to_cpu(fw_hdr->arr.offset), \ (u8 *)bp->arr, len); \ } while (0)
drivers/net/ethernet/brocade/bna/bnad_debugfs.c +3 -18
@@ -61,10 +61,8 @@ bnad_debugfs_open_fwtrc(struct inode *inode, struct file *file) fw_debug->debug_buffer =kzalloc (fw_debug->buffer_len,GFP_KERNEL );if (!fw_debug->debug_buffer) {kfree (fw_debug); fw_debug =NULL ; -pr_warn ("bna %s: Failed to allocate fwtrc buffer\n" , -pci_name (bnad->pcidev));return -ENOMEM ; }spin_lock_irqsave (&bnad->bna_lock, flags);
@@ -104,10 +102,8 @@ bnad_debugfs_open_fwsave(struct inode *inode, struct file *file) fw_debug->debug_buffer =kzalloc (fw_debug->buffer_len,GFP_KERNEL );if (!fw_debug->debug_buffer) {kfree (fw_debug); fw_debug =NULL ; -pr_warn ("bna %s: Failed to allocate fwsave buffer\n" , -pci_name (bnad->pcidev));return -ENOMEM ; }spin_lock_irqsave (&bnad->bna_lock, flags);
@@ -207,10 +203,8 @@ bnad_debugfs_open_drvinfo(struct inode *inode, struct file *file) drv_info->debug_buffer =kzalloc (drv_info->buffer_len,GFP_KERNEL );if (!drv_info->debug_buffer) {kfree (drv_info); drv_info =NULL ; -pr_warn ("bna %s: Failed to allocate drv info buffer\n" , -pci_name (bnad->pcidev));return -ENOMEM ; }mutex_lock (&bnad->conf_mutex);
@@ -347,13 +341,10 @@ bnad_debugfs_write_regrd(struct file *file, const char __user *buf,void *kern_buf;/* Allocate memory to store the user space buf */ kern_buf =kzalloc (nbytes,GFP_KERNEL ); -if (!kern_buf) { -pr_warn ("bna %s: Failed to allocate user buffer\n" , -pci_name (bnad->pcidev)); +if (!kern_buf)return -ENOMEM ; - }if (copy_from_user (kern_buf, (void __user *)buf, nbytes)) {kfree (kern_buf);return -ENOMEM ;
@@ -372,13 +363,10 @@ bnad_debugfs_write_regrd(struct file *file, const char __user *buf, bnad->regdata =NULL ; bnad->reglen =0 ; bnad->regdata =kzalloc (len <<2 ,GFP_KERNEL ); -if (!bnad->regdata) { -pr_warn ("bna %s: Failed to allocate regrd buffer\n" , -pci_name (bnad->pcidev)); +if (!bnad->regdata)return -ENOMEM ; - } bnad->reglen = len <<2 ; rb =bfa_ioc_bar0 (ioc); addr &=BFA_REG_ADDRMSK (ioc);
@@ -420,13 +408,10 @@ bnad_debugfs_write_regwr(struct file *file, const char __user *buf,void *kern_buf;/* Allocate memory to store the user space buf */ kern_buf =kzalloc (nbytes,GFP_KERNEL ); -if (!kern_buf) { -pr_warn ("bna %s: Failed to allocate user buffer\n" , -pci_name (bnad->pcidev)); +if (!kern_buf)return -ENOMEM ; - }if (copy_from_user (kern_buf, (void __user *)buf, nbytes)) {kfree (kern_buf);return -ENOMEM ;
drivers/net/ethernet/cisco/enic/enic_main.c +0 -1
@@ -2387,9 +2387,8 @@ static int __devinit enic_probe(struct pci_dev *pdev,/* Allocate structure for port profiles */ enic->pp =kcalloc (num_pps,sizeof (*enic->pp),GFP_KERNEL );if (!enic->pp) { -pr_err ("port profile alloc failed, aborting\n" ); err = -ENOMEM ; goto err_out_disable_sriov_pp; }
drivers/net/ethernet/cisco/enic/vnic_rq.c +1 -3
@@ -37,12 +37,10 @@ static int vnic_rq_alloc_bufs(struct vnic_rq *rq) vdev = rq->vdev;for (i =0 ; i < blks; i++) { rq->bufs[i] =kzalloc (VNIC_RQ_BUF_BLK_SZ (count),GFP_ATOMIC ); -if (!rq->bufs[i]) { -pr_err ("Failed to alloc rq_bufs\n" ); +if (!rq->bufs[i])return -ENOMEM ; - } }for (i =0 ; i < blks; i++) { buf = rq->bufs[i];
drivers/net/ethernet/cisco/enic/vnic_wq.c +1 -3
@@ -37,12 +37,10 @@ static int vnic_wq_alloc_bufs(struct vnic_wq *wq) vdev = wq->vdev;for (i =0 ; i < blks; i++) { wq->bufs[i] =kzalloc (VNIC_WQ_BUF_BLK_SZ (count),GFP_ATOMIC ); -if (!wq->bufs[i]) { -pr_err ("Failed to alloc wq_bufs\n" ); +if (!wq->bufs[i])return -ENOMEM ; - } }for (i =0 ; i < blks; i++) { buf = wq->bufs[i];
drivers/net/ethernet/i825xx/lp486e.c +0 -2
@@ -453,10 +453,8 @@ init_rx_bufs(struct net_device *dev, int num) { lp->rbd_tail = rbd; } rfd->rbd = rbd; - }else { -printk ("Could not kmalloc rbd\n" ); } } lp->rbd_tail->next = rfd->rbd;#endif
drivers/net/ethernet/ibm/emac/rgmii.c +1 -4
@@ -236,13 +236,10 @@ static int __devinit rgmii_probe(struct platform_device *ofdev)int rc; rc = -ENOMEM ; dev =kzalloc (sizeof (struct rgmii_instance ),GFP_KERNEL ); -if (dev ==NULL ) { -printk (KERN_ERR "%s: could not allocate RGMII device!\n" , - np->full_name); +if (dev ==NULL ) goto err_gone; - }mutex_init (&dev->lock); dev->ofdev = ofdev;
drivers/net/ethernet/ibm/emac/tah.c +1 -4
@@ -95,13 +95,10 @@ static int __devinit tah_probe(struct platform_device *ofdev)int rc; rc = -ENOMEM ; dev =kzalloc (sizeof (struct tah_instance ),GFP_KERNEL ); -if (dev ==NULL ) { -printk (KERN_ERR "%s: could not allocate TAH device!\n" , - np->full_name); +if (dev ==NULL ) goto err_gone; - }mutex_init (&dev->lock); dev->ofdev = ofdev;
drivers/net/ethernet/ibm/emac/zmii.c +1 -4
@@ -239,13 +239,10 @@ static int __devinit zmii_probe(struct platform_device *ofdev)int rc; rc = -ENOMEM ; dev =kzalloc (sizeof (struct zmii_instance ),GFP_KERNEL ); -if (dev ==NULL ) { -printk (KERN_ERR "%s: could not allocate ZMII device!\n" , - np->full_name); +if (dev ==NULL ) goto err_gone; - }mutex_init (&dev->lock); dev->ofdev = ofdev; dev->mode =PHY_MODE_NA ;
drivers/net/ethernet/intel/e1000/e1000_main.c +1 -3
@@ -729,12 +729,10 @@ static void e1000_dump_eeprom(struct e1000_adapter *adapter) eeprom.len = ops->get_eeprom_len (netdev); eeprom.offset =0 ; data =kmalloc (eeprom.len,GFP_KERNEL ); -if (!data) { -pr_err ("Unable to allocate memory to dump EEPROM data\n" ); +if (!data)return ; - } ops->get_eeprom (netdev, &eeprom, data); csum_old = (data[EEPROM_CHECKSUM_REG * 2]) +
drivers/net/ethernet/intel/ixgb/ixgb_main.c +1 -3
@@ -1135,12 +1135,10 @@ ixgb_set_multi(struct net_device *netdev) }else {u8 *mta =kmalloc (IXGB_MAX_NUM_MULTICAST_ADDRESSES *ETH_ALEN ,GFP_ATOMIC );u8 *addr; -if (!mta) { -pr_err ("allocation of multicast memory failed\n" ); +if (!mta) goto alloc_failed; - }IXGB_WRITE_REG (hw,RCTL , rctl); addr = mta;
drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c +1 -5
@@ -2516,14 +2516,10 @@ int ixgbevf_setup_rx_resources(struct ixgbevf_adapter *adapter,int size; size =sizeof (struct ixgbevf_rx_buffer ) * rx_ring->count; rx_ring->rx_buffer_info =vzalloc (size); -if (!rx_ring->rx_buffer_info) { -hw_dbg (&adapter->hw, -"Unable to vmalloc buffer memory for " -"the receive descriptor ring\n" ); +if (!rx_ring->rx_buffer_info) goto alloc_failed; - }/* Round up to nearest 4K */ rx_ring->size = rx_ring->count *sizeof (union ixgbe_adv_rx_desc ); rx_ring->size =ALIGN (rx_ring->size,4096 );
drivers/net/ethernet/korina.c +0 -1
@@ -1149,9 +1149,8 @@ static int korina_probe(struct platform_device *pdev) } lp->td_ring =kmalloc (TD_RING_SIZE +RD_RING_SIZE ,GFP_KERNEL );if (!lp->td_ring) { - printk(KERN_ERR DRV_NAME ": cannot allocate descriptors\n"); rc = -ENXIO ; goto probe_err_td_ring; }
drivers/net/ethernet/marvell/pxa168_eth.c +4 -6
@@ -1016,12 +1016,11 @@ static int rxq_init(struct net_device *dev)/* Allocate RX skb rings */ pep->rx_skb =kmalloc (sizeof (*pep->rx_skb) * pep->rx_ring_size,GFP_KERNEL ); -if (!pep->rx_skb) { -printk (KERN_ERR "%s: Cannot alloc RX skb ring\n" , dev->name); +if (!pep->rx_skb)return -ENOMEM ; - } +/* Allocate RX ring */ pep->rx_desc_count =0 ; size = pep->rx_ring_size *sizeof (struct rx_desc ); pep->rx_desc_area_size = size;
@@ -1080,12 +1079,11 @@ static int txq_init(struct net_device *dev)int tx_desc_num = pep->tx_ring_size; pep->tx_skb =kmalloc (sizeof (*pep->tx_skb) * pep->tx_ring_size,GFP_KERNEL ); -if (!pep->tx_skb) { -printk (KERN_ERR "%s: Cannot alloc TX skb ring\n" , dev->name); +if (!pep->tx_skb)return -ENOMEM ; - } +/* Allocate TX ring */ pep->tx_desc_count =0 ; size = pep->tx_ring_size *sizeof (struct tx_desc ); pep->tx_desc_area_size = size;
drivers/net/ethernet/mellanox/mlx4/en_rx.c +2 -3
@@ -280,12 +280,11 @@ int mlx4_en_create_rx_ring(struct mlx4_en_priv *priv, tmp = size *roundup_pow_of_two (MLX4_EN_MAX_RX_FRAGS *sizeof (struct skb_frag_struct )); ring->rx_info =vmalloc (tmp); -if (!ring->rx_info) { -en_err (priv,"Failed allocating rx_info ring\n" ); +if (!ring->rx_info)return -ENOMEM ; - } +en_dbg (DRV , priv,"Allocated rx_info ring at addr:%p size:%d\n" , ring->rx_info, tmp); err = mlx4_alloc_hwq_res(mdev->dev, &ring->wqres,
drivers/net/ethernet/mellanox/mlx4/en_tx.c +2 -4
@@ -70,18 +70,16 @@ int mlx4_en_create_tx_ring(struct mlx4_en_priv *priv,spin_lock_init (&ring->comp_lock); tmp = size *sizeof (struct mlx4_en_tx_info ); ring->tx_info =vmalloc (tmp); -if (!ring->tx_info) { -en_err (priv,"Failed allocating tx_info ring\n" ); +if (!ring->tx_info)return -ENOMEM ; - } +en_dbg (DRV , priv,"Allocated tx_info ring at addr:%p size:%d\n" , ring->tx_info, tmp); ring->bounce_buf =kmalloc (MAX_DESC_SIZE ,GFP_KERNEL );if (!ring->bounce_buf) { -en_err (priv,"Failed allocating bounce buffer\n" ); err = -ENOMEM ; goto err_tx; } ring->buf_size =ALIGN (size * ring->stride,MLX4_EN_PAGE_SIZE );
drivers/net/ethernet/micrel/ks8851_mll.c +1 -3
@@ -1500,12 +1500,10 @@ static int ks_hw_init(struct ks_net *ks) ks->all_mcast =0 ; ks->mcast_lst_size =0 ; ks->frame_head_info =kmalloc (MHEADER_SIZE ,GFP_KERNEL ); -if (!ks->frame_head_info) { -pr_err ("Error: Fail to allocate frame memory\n" ); +if (!ks->frame_head_info)return false; - }ks_set_mac (ks,KS_DEFAULT_MAC_ADDRESS );return true; }
drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c +3 -6
@@ -1586,12 +1586,10 @@ int pch_gbe_setup_tx_resources(struct pch_gbe_adapter *adapter,int desNo; size = (int )sizeof (struct pch_gbe_buffer ) * tx_ring->count; tx_ring->buffer_info =vzalloc (size); -if (!tx_ring->buffer_info) { -pr_err ("Unable to allocate memory for the buffer information\n" ); +if (!tx_ring->buffer_info)return -ENOMEM ; - } tx_ring->size = tx_ring->count * (int )sizeof (struct pch_gbe_tx_desc ); tx_ring->desc = dma_alloc_coherent(&pdev->dev, tx_ring->size,
@@ -1635,12 +1633,11 @@ int pch_gbe_setup_rx_resources(struct pch_gbe_adapter *adapter,int desNo; size = (int )sizeof (struct pch_gbe_buffer ) * rx_ring->count; rx_ring->buffer_info =vzalloc (size); -if (!rx_ring->buffer_info) { -pr_err ("Unable to allocate memory for the receive descriptor ring\n" ); +if (!rx_ring->buffer_info)return -ENOMEM ; - } + rx_ring->size = rx_ring->count * (int )sizeof (struct pch_gbe_rx_desc ); rx_ring->desc =dma_alloc_coherent (&pdev->dev, rx_ring->size, &rx_ring->dma,GFP_KERNEL );
drivers/net/ethernet/qlogic/netxen/netxen_nic_init.c +3 -9
@@ -279,15 +279,12 @@ int netxen_alloc_sw_resources(struct netxen_adapter *adapter)break ; } rds_ring->rx_buf_arr =vzalloc (RCV_BUFF_RINGSIZE (rds_ring)); -if (rds_ring->rx_buf_arr ==NULL ) { -printk (KERN_ERR "%s: Failed to allocate " -"rx buffer ring %d\n" , - netdev->name, ring); +if (rds_ring->rx_buf_arr ==NULL )/* free whatever was already allocated */ goto err_out; - } +INIT_LIST_HEAD (&rds_ring->free_list);/* * Now go through all of them, set reference handles * and put them in the queues.
@@ -479,13 +476,10 @@ int netxen_pinit_from_rom(struct netxen_adapter *adapter)return -EIO ; } buf =kcalloc (n,sizeof (struct crb_addr_pair ),GFP_KERNEL ); -if (buf ==NULL ) { -printk ("%s: netxen_pinit_from_rom: Unable to calloc memory.\n" , - netxen_nic_driver_name); +if (buf ==NULL )return -ENOMEM ; - }for (i =0 ; i < n; i++) {if (netxen_rom_fast_read (adapter,8 *i +4 *offset, &val) !=0 ||netxen_rom_fast_read (adapter,8 *i +4 *offset +4 , &addr) !=0 ) {
drivers/net/ethernet/qlogic/qlge/qlge_dbg.c +1 -3
@@ -1823,12 +1823,10 @@ void ql_dump_hw_cb(struct ql_adapter *qdev, int size, u32 bit, u16 q_id)pr_err ("%s: Enter\n" , __func__); ptr =kmalloc (size,GFP_ATOMIC ); -if (ptr ==NULL ) { -pr_err ("%s: Couldn't allocate a buffer\n" , __func__); +if (ptr ==NULL )return ; - }if (ql_write_cfg (qdev, ptr, size, bit, q_id)) {pr_err ("%s: Failed to upload control block!\n" , __func__); goto fail_it;
drivers/net/ethernet/sis/sis900.c +0 -1
@@ -618,9 +618,8 @@ static int __devinit sis900_mii_probe(struct net_device * net_dev)continue ; }if ((mii_phy =kmalloc (sizeof (struct mii_phy ),GFP_KERNEL )) ==NULL ) { -printk (KERN_WARNING "Cannot allocate mem for struct mii_phy\n" ); mii_phy = sis_priv->first_mii;while (mii_phy) {struct mii_phy *phy; phy = mii_phy;
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +2 -3
@@ -953,12 +953,11 @@ static int stmmac_open(struct net_device *dev) }#ifdef CONFIG_STMMAC_TIMER priv->tm =kzalloc (sizeof (struct stmmac_timer *),GFP_KERNEL ); -if (unlikely (priv->tm ==NULL )) { -pr_err ("%s: ERROR: timer memory alloc failed\n" , __func__); +if (unlikely (priv->tm ==NULL ))return -ENOMEM ; - } + priv->tm->freq = tmrate;/* Test if the external timer can be actually used. * In case of failure continue without timer. */
drivers/net/ethernet/sun/cassini.c +0 -1
@@ -834,9 +834,8 @@ static int cas_saturn_firmware_init(struct cas *cp) cp->fw_size = fw->size -2 ; cp->fw_data =vmalloc (cp->fw_size);if (!cp->fw_data) { err = -ENOMEM ; -pr_err ("\"%s\" Failed %d\n" , fw_name, err); goto out; }memcpy (cp->fw_data, &fw->data[2 ], cp->fw_size); out:
drivers/net/ethernet/sun/sunvnet.c +3 -6
@@ -948,12 +948,11 @@ static int __devinit vnet_port_alloc_tx_bufs(struct vnet_port *port)void *buf =kzalloc (ETH_FRAME_LEN +8 ,GFP_KERNEL );int map_len = (ETH_FRAME_LEN +7 ) & ~7 ; err = -ENOMEM ; -if (!buf) { -pr_err ("TX buffer allocation failure\n" ); +if (!buf) goto err_out; - } + err = -EFAULT ;if ((unsigned long )buf & (8UL -1 )) {pr_err ("TX buffer misaligned\n" );kfree (buf);
@@ -1164,12 +1163,10 @@ static int __devinit vnet_port_probe(struct vio_dev *vdev, } port =kzalloc (sizeof (*port),GFP_KERNEL ); err = -ENOMEM ; -if (!port) { -pr_err ("Cannot allocate vnet_port\n" ); +if (!port) goto err_out_put_mdesc; - }for (i =0 ; i <ETH_ALEN ; i++) port->raddr[i] = (*rmac >> (5 - i) *8 ) &0xff ;
drivers/net/ethernet/toshiba/ps3_gelic_wireless.c +2 -3
@@ -1620,12 +1620,11 @@ static void gelic_wl_scan_complete_event(struct gelic_wl_info *wl) target->eurus_index = i;kfree (target->hwinfo); target->hwinfo =kzalloc (be16_to_cpu (scan_info->size),GFP_KERNEL ); -if (!target->hwinfo) { -pr_info ("%s: kzalloc failed\n" , __func__); +if (!target->hwinfo)continue ; - } +/* copy hw scan info */ memcpy (target->hwinfo, scan_info, scan_info->size); target->essid_len =strnlen (scan_info->essid,sizeof (scan_info->essid));
drivers/net/hamradio/yam.c +0 -1
@@ -402,9 +402,8 @@ static unsigned char *add_mcs(unsigned char *bits, int bitrate, }/* Allocate a new mcs */ if ((p =kmalloc (sizeof (struct yam_mcs ),GFP_KERNEL )) ==NULL ) { -printk (KERN_WARNING "YAM: no memory to allocate mcs\n" );release_firmware (fw);return NULL ; }memcpy (p->bits, bits,YAM_FPGA_SIZE );
drivers/net/hippi/rrunner.c +1 -7
@@ -1599,14 +1599,10 @@ static int rr_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)return -EPERM ; } image =kmalloc (EEPROM_WORDS *sizeof (u32),GFP_KERNEL ); -if (!image){ -printk (KERN_ERR "%s: Unable to allocate memory " -"for EEPROM image\n" , dev->name); +if (!image)return -ENOMEM ; - } -if (rrpriv->fw_running){printk ("%s: Firmware already running\n" , dev->name); error = -EPERM ;
@@ -1636,10 +1632,8 @@ static int rr_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) image =kmalloc (EEPROM_WORDS *sizeof (u32),GFP_KERNEL ); oldimage =kmalloc (EEPROM_WORDS *sizeof (u32),GFP_KERNEL );if (!image || !oldimage) { -printk (KERN_ERR "%s: Unable to allocate memory " -"for EEPROM image\n" , dev->name); error = -ENOMEM ; goto wf_out; }
drivers/net/irda/donauboe.c +0 -2
@@ -1607,9 +1607,8 @@ toshoboe_open (struct pci_dev *pci_dev, const struct pci_device_id *pdid)/* Allocate twice the size to guarantee alignment */ self->ringbuf =kmalloc (OBOE_RING_LEN <<1 ,GFP_KERNEL );if (!self->ringbuf) { - printk (KERN_ERR DRIVER_NAME ": can't allocate DMA buffers\n"); err = -ENOMEM ; goto freeregion; }
@@ -1646,9 +1645,8 @@ toshoboe_open (struct pci_dev *pci_dev, const struct pci_device_id *pdid) }if (!ok) { - printk (KERN_ERR DRIVER_NAME ": can't allocate rx/tx buffers\n"); err = -ENOMEM ; goto freebufs; }
drivers/net/netconsole.c +2 -6
@@ -168,12 +168,10 @@ static struct netconsole_target *alloc_param_target(char *target_config)* Allocate and initialize with defaults. * Note that these targets get their config_item fields zeroed-out. */ nt =kzalloc (sizeof (*nt),GFP_KERNEL ); -if (!nt) { -printk (KERN_ERR "netconsole: failed to allocate memory\n" ); +if (!nt) goto fail; - } nt->np.name ="netconsole" ;strlcpy (nt->np.dev_name,"eth0" ,IFNAMSIZ ); nt->np.local_port =6665 ;
@@ -550,12 +548,10 @@ static struct config_item *make_netconsole_target(struct config_group *group,* Allocate and initialize with defaults. * Target is disabled at creation (enabled == 0). */ nt =kzalloc (sizeof (*nt),GFP_KERNEL ); -if (!nt) { -printk (KERN_ERR "netconsole: failed to allocate memory\n" ); +if (!nt)return ERR_PTR (-ENOMEM ); - } nt->np.name ="netconsole" ;strlcpy (nt->np.dev_name,"eth0" ,IFNAMSIZ ); nt->np.local_port =6665 ;
drivers/net/ppp/pptp.c +1 -3
@@ -669,12 +669,10 @@ static int __init pptp_init_module(void)int err =0 ;pr_info ("PPTP driver version " PPTP_DRIVER_VERSION "\n" ); callid_sock =vzalloc ((MAX_CALLID +1 ) *sizeof (void *)); -if (!callid_sock) { -pr_err ("PPTP: cann't allocate memory\n" ); +if (!callid_sock)return -ENOMEM ; - } err =gre_add_protocol (&gre_pptp_protocol,GREPROTO_PPTP );if (err) {pr_err ("PPTP: can't add gre protocol\n" );
drivers/net/slip/slip.c +1 -3
@@ -1295,12 +1295,10 @@ static int __init slip_init(void)#endif slip_devs =kzalloc (sizeof (struct net_device *)*slip_maxdev,GFP_KERNEL ); -if (!slip_devs) { -printk (KERN_ERR "SLIP: Can't allocate slip devices array.\n" ); +if (!slip_devs)return -ENOMEM ; - }/* Fill in our line protocol discipline, and register it */ status =tty_register_ldisc (N_SLIP , &sl_ldisc);if (status !=0 ) {
drivers/net/tokenring/3c359.c +0 -4
@@ -673,17 +673,13 @@ static int xl_open(struct net_device *dev)*/ /* These MUST be on 8 byte boundaries */ xl_priv->xl_tx_ring =kzalloc ((sizeof (struct xl_tx_desc ) *XL_TX_RING_SIZE ) +7 ,GFP_DMA |GFP_KERNEL );if (xl_priv->xl_tx_ring ==NULL ) { -printk (KERN_WARNING "%s: Not enough memory to allocate tx buffers.\n" , - dev->name);free_irq (dev->irq,dev);return -ENOMEM ; } xl_priv->xl_rx_ring =kzalloc ((sizeof (struct xl_rx_desc ) *XL_RX_RING_SIZE ) +7 ,GFP_DMA |GFP_KERNEL );if (xl_priv->xl_rx_ring ==NULL ) { -printk (KERN_WARNING "%s: Not enough memory to allocate rx buffers.\n" , - dev->name);free_irq (dev->irq,dev);kfree (xl_priv->xl_tx_ring);return -ENOMEM ; }
drivers/net/tokenring/madgemc.c +0 -1
@@ -170,9 +170,8 @@ static int __devinit madgemc_probe(struct device *device) dev->netdev_ops = &madgemc_netdev_ops; card =kmalloc (sizeof (struct card_info ),GFP_KERNEL );if (card==NULL ) { -printk ("madgemc: unable to allocate card struct\n" ); ret = -ENOMEM ; goto getout1; }
drivers/net/vmxnet3/vmxnet3_drv.c +3 -12
@@ -536,13 +536,10 @@ vmxnet3_tq_create(struct vmxnet3_tx_queue *tq, } tq->buf_info =kcalloc (tq->tx_ring.size,sizeof (tq->buf_info[0 ]),GFP_KERNEL ); -if (!tq->buf_info) { -printk (KERN_ERR "%s: failed to allocate tx bufinfo\n" , - adapter->netdev->name); +if (!tq->buf_info) goto err; - }return 0 ; err:
@@ -1518,13 +1515,11 @@ vmxnet3_rq_create(struct vmxnet3_rx_queue *rq, struct vmxnet3_adapter *adapter) sz =sizeof (struct vmxnet3_rx_buf_info ) * (rq->rx_ring[0 ].size + rq->rx_ring[1 ].size); bi =kzalloc (sz,GFP_KERNEL ); -if (!bi) { -printk (KERN_ERR "%s: failed to allocate rx bufinfo\n" , - adapter->netdev->name); +if (!bi) goto err; - } + rq->buf_info[0 ] = bi; rq->buf_info[1 ] = bi + rq->rx_ring[0 ].size;return 0 ;
@@ -2963,20 +2958,16 @@ vmxnet3_probe_device(struct pci_dev *pdev, adapter->num_tx_queues); adapter->pm_conf =kmalloc (sizeof (struct Vmxnet3_PMConf ),GFP_KERNEL );if (adapter->pm_conf ==NULL ) { -printk (KERN_ERR "Failed to allocate memory for %s\n" , -pci_name (pdev)); err = -ENOMEM ; goto err_alloc_pm; }#ifdef VMXNET3_RSS adapter->rss_conf =kmalloc (sizeof (struct UPT1_RSSConf ),GFP_KERNEL );if (adapter->rss_conf ==NULL ) { -printk (KERN_ERR "Failed to allocate memory for %s\n" , -pci_name (pdev)); err = -ENOMEM ; goto err_alloc_rss; }#endif /* VMXNET3_RSS */
drivers/net/wan/c101.c +1 -3
@@ -324,12 +324,10 @@ static int __init c101_run(unsigned long irq, unsigned long winbase)return -ENODEV ; } card =kzalloc (sizeof (card_t),GFP_KERNEL ); -if (card ==NULL ) { -pr_err ("unable to allocate memory\n" ); +if (card ==NULL )return -ENOBUFS ; - } card->dev =alloc_hdlcdev (card);if (!card->dev) {pr_err ("unable to allocate memory\n" );
drivers/net/wan/dscc4.c +2 -6
@@ -902,24 +902,20 @@ static int dscc4_found1(struct pci_dev *pdev, void __iomem *ioaddr)struct dscc4_dev_priv *root;int i, ret = -ENOMEM ; root =kcalloc (dev_per_card,sizeof (*root),GFP_KERNEL ); -if (!root) { -pr_err ("can't allocate data\n" ); +if (!root) goto err_out; - }for (i =0 ; i < dev_per_card; i++) { root[i].dev =alloc_hdlcdev (root + i);if (!root[i].dev) goto err_free_dev; } ppriv =kzalloc (sizeof (*ppriv),GFP_KERNEL ); -if (!ppriv) { -pr_err ("can't allocate private data\n" ); +if (!ppriv) goto err_free_dev; - } ppriv->root = root;spin_lock_init (&ppriv->lock);
drivers/net/wan/lmc/lmc_main.c +0 -1
@@ -496,9 +496,8 @@ int lmc_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) /*fold00*/ } data =kmalloc (xc.len,GFP_KERNEL );if (!data) { -printk (KERN_WARNING "%s: Failed to allocate memory for copy\n" , dev->name); ret = -ENOMEM ;break ; }
drivers/net/wan/n2.c +1 -3
@@ -357,12 +357,10 @@ static int __init n2_run(unsigned long io, unsigned long irq,return -ENODEV ; } card =kzalloc (sizeof (card_t),GFP_KERNEL ); -if (card ==NULL ) { -pr_err ("unable to allocate memory\n" ); +if (card ==NULL )return -ENOBUFS ; - } card->ports[0 ].dev =alloc_hdlcdev (&card->ports[0 ]); card->ports[1 ].dev =alloc_hdlcdev (&card->ports[1 ]);if (!card->ports[0 ].dev || !card->ports[1 ].dev) {
drivers/net/wan/pc300too.c +0 -1
@@ -319,9 +319,8 @@ static int __devinit pc300_pci_init_one(struct pci_dev *pdev, } card =kzalloc (sizeof (card_t),GFP_KERNEL );if (card ==NULL ) { -pr_err ("unable to allocate memory\n" );pci_release_regions (pdev);pci_disable_device (pdev);return -ENOBUFS ; }
drivers/net/wan/pci200syn.c +0 -1
@@ -298,9 +298,8 @@ static int __devinit pci200_pci_init_one(struct pci_dev *pdev, } card =kzalloc (sizeof (card_t),GFP_KERNEL );if (card ==NULL ) { -pr_err ("unable to allocate memory\n" );pci_release_regions (pdev);pci_disable_device (pdev);return -ENOBUFS ; }
drivers/net/wan/wanxl.c +0 -1
@@ -603,9 +603,8 @@ static int __devinit wanxl_pci_init_one(struct pci_dev *pdev, alloc_size =sizeof (card_t) + ports *sizeof (port_t); card =kzalloc (alloc_size,GFP_KERNEL );if (card ==NULL ) { -pr_err ("%s: unable to allocate memory\n" ,pci_name (pdev));pci_release_regions (pdev);pci_disable_device (pdev);return -ENOBUFS ; }
drivers/net/wan/x25_asy.c +1 -3
@@ -785,12 +785,10 @@ static int __init init_x25_asy(void) x25_asy_maxdev); x25_asy_devs =kcalloc (x25_asy_maxdev,sizeof (struct net_device *),GFP_KERNEL ); -if (!x25_asy_devs) { -pr_warn ("Can't allocate x25_asy_ctrls[] array! Uaargh! (-> No X.25 available)\n" ); +if (!x25_asy_devs)return -ENOMEM ; - }return tty_register_ldisc (N_X25 , &x25_ldisc); }
drivers/net/wireless/ath/ath9k/htc_hst.c +1 -4
@@ -430,13 +430,10 @@ struct htc_target *ath9k_htc_hw_alloc(void *hif_handle,struct htc_endpoint *endpoint;struct htc_target *target; target =kzalloc (sizeof (struct htc_target ),GFP_KERNEL ); -if (!target) { -printk (KERN_ERR "Unable to allocate memory for" -"target device\n" ); +if (!target)return NULL ; - }init_completion (&target->target_wait);init_completion (&target->cmd_wait);
drivers/net/wireless/hostap/hostap_hw.c +6 -12
@@ -346,13 +346,11 @@ static int hfa384x_cmd(struct net_device *dev, u16 cmd, u16 param0,if (signal_pending (current))return -EINTR ; entry =kzalloc (sizeof (*entry),GFP_ATOMIC ); -if (entry ==NULL ) { -printk (KERN_DEBUG "%s: hfa384x_cmd - kmalloc failed\n" , - dev->name); +if (entry ==NULL )return -ENOMEM ; - } +atomic_set (&entry->usecnt,1 ); entry->type =CMD_SLEEP ; entry->cmd = cmd; entry->param0 = param0;
@@ -514,13 +512,11 @@ static int hfa384x_cmd_callback(struct net_device *dev, u16 cmd, u16 param0,return -1 ; } entry =kzalloc (sizeof (*entry),GFP_ATOMIC ); -if (entry ==NULL ) { -printk (KERN_DEBUG "%s: hfa384x_cmd_callback - kmalloc " -"failed\n" , dev->name); +if (entry ==NULL )return -ENOMEM ; - } +atomic_set (&entry->usecnt,1 ); entry->type =CMD_CALLBACK ; entry->cmd = cmd; entry->param0 = param0;
@@ -2977,13 +2973,11 @@ static int prism2_set_tim(struct net_device *dev, int aid, int set) iface =netdev_priv (dev); local = iface->local; new_entry =kzalloc (sizeof (*new_entry),GFP_ATOMIC ); -if (new_entry ==NULL ) { -printk (KERN_DEBUG "%s: prism2_set_tim: kmalloc failed\n" , - local->dev->name); +if (new_entry ==NULL )return -ENOMEM ; - } + new_entry->aid = aid; new_entry->set = set;spin_lock_bh (&local->set_tim_lock);
drivers/net/wireless/ipw2x00/ipw2100.c +1 -4
@@ -3463,13 +3463,10 @@ static int ipw2100_msg_allocate(struct ipw2100_priv *priv) priv->msg_buffers =kmalloc (IPW_COMMAND_POOL_SIZE *sizeof (struct ipw2100_tx_packet ),GFP_KERNEL ); -if (!priv->msg_buffers) { - printk(KERN_ERR DRV_NAME ": %s: PCI alloc failed for msg " - "buffers.\n", priv->net_dev->name); +if (!priv->msg_buffers)return -ENOMEM ; - }for (i =0 ; i <IPW_COMMAND_POOL_SIZE ; i++) { v =pci_alloc_consistent (priv->pci_dev,sizeof (struct ipw2100_cmd_header ), &p);
drivers/net/wireless/libertas/if_cs.c +2 -3
@@ -814,12 +814,11 @@ static int if_cs_probe(struct pcmcia_device *p_dev)lbs_deb_enter (LBS_DEB_CS ); card =kzalloc (sizeof (struct if_cs_card ),GFP_KERNEL ); -if (!card) { -pr_err ("error in kzalloc\n" ); +if (!card) goto out; - } + card->p_dev = p_dev; p_dev->priv = card; p_dev->config_flags |=CONF_ENABLE_IRQ |CONF_AUTO_SET_IO ;
drivers/net/wireless/libertas/if_usb.c +1 -3
@@ -260,12 +260,10 @@ static int if_usb_probe(struct usb_interface *intf, udev =interface_to_usbdev (intf); cardp =kzalloc (sizeof (struct if_usb_card ),GFP_KERNEL ); -if (!cardp) { -pr_err ("Out of memory allocating private data\n" ); +if (!cardp) goto error; - }setup_timer (&cardp->fw_timeout, if_usb_fw_timeo, (unsigned long )cardp);init_waitqueue_head (&cardp->fw_wq);
drivers/net/wireless/libertas_tf/if_usb.c +1 -3
@@ -152,12 +152,10 @@ static int if_usb_probe(struct usb_interface *intf,lbtf_deb_enter (LBTF_DEB_USB ); udev =interface_to_usbdev (intf); cardp =kzalloc (sizeof (struct if_usb_card ),GFP_KERNEL ); -if (!cardp) { -pr_err ("Out of memory allocating private data.\n" ); +if (!cardp) goto error; - }setup_timer (&cardp->fw_timeout, if_usb_fw_timeo, (unsigned long )cardp);init_waitqueue_head (&cardp->fw_wq);
drivers/net/wireless/mwifiex/pcie.c +1 -3
@@ -85,12 +85,10 @@ static int mwifiex_pcie_probe(struct pci_dev *pdev,pr_debug ("info: vendor=0x%4.04X device=0x%4.04X rev=%d\n" , pdev->vendor, pdev->device, pdev->revision); card =kzalloc (sizeof (struct pcie_service_card ),GFP_KERNEL ); -if (!card) { -pr_err ("%s: failed to alloc memory\n" , __func__); +if (!card)return -ENOMEM ; - } card->dev = pdev; if (mwifiex_add_card(card, &add_remove_card_sem, &pcie_ops,
drivers/net/wireless/mwifiex/sdio.c +1 -3
@@ -69,12 +69,10 @@ mwifiex_sdio_probe(struct sdio_func *func, const struct sdio_device_id *id)pr_debug ("info: vendor=0x%4.04X device=0x%4.04X class=%d function=%d\n" , func->vendor, func->device, func->class, func->num); card =kzalloc (sizeof (struct sdio_mmc_card ),GFP_KERNEL ); -if (!card) { -pr_err ("%s: failed to alloc memory\n" , __func__); +if (!card)return -ENOMEM ; - } card->func = func; func->card->quirks |=MMC_QUIRK_BLKSZ_FOR_BYTE_MODE ;
drivers/net/wireless/orinoco/main.c +2 -4
@@ -940,13 +940,11 @@ void __orinoco_ev_rx(struct net_device *dev, struct hermes *hw) }/* Add desc and skb to rx queue */ rx_data =kzalloc (sizeof (*rx_data),GFP_ATOMIC ); -if (!rx_data) { -printk (KERN_WARNING "%s: Can't allocate RX packet\n" , - dev->name); +if (!rx_data) goto drop; - } + rx_data->desc = desc; rx_data->skb = skb;list_add_tail (&rx_data->list, &priv->rx_list);tasklet_schedule (&priv->rx_tasklet);
drivers/net/wireless/prism54/islpci_mgt.c +2 -4
@@ -191,13 +191,11 @@ islpci_mgt_transmit(struct net_device *ndev, int operation, unsigned long oid, } err = -ENOMEM ; p = buf.mem =kmalloc (frag_len,GFP_KERNEL ); -if (!buf.mem) { -printk (KERN_DEBUG "%s: cannot allocate mgmt frame\n" , - ndev->name); +if (!buf.mem) goto error; - } + buf.size = frag_len;/* create the header directly in the fragment data area */ pimfor_encode_header (operation, oid, length, (pimfor_header_t *) p);
drivers/net/wireless/rtlwifi/rtl8192ce/sw.c +1 -4
@@ -156,13 +156,10 @@ int rtl92c_init_sw_vars(struct ieee80211_hw *hw) rtlpriv->psc.fwctrl_psmode =FW_PS_DTIM_MODE ;/* for firmware buf */ rtlpriv->rtlhal.pfirmware =vzalloc (0x4000 ); -if (!rtlpriv->rtlhal.pfirmware) { -RT_TRACE (rtlpriv,COMP_ERR ,DBG_EMERG , -"Can't alloc buffer for fw\n" ); +if (!rtlpriv->rtlhal.pfirmware)return 1 ; - }/* request fw */ if (IS_VENDOR_UMC_A_CUT (rtlhal->version) && !IS_92C_SERIAL (rtlhal->version))
drivers/net/wireless/rtlwifi/rtl8192cu/sw.c +2 -4
@@ -62,13 +62,11 @@ static int rtl92cu_init_sw_vars(struct ieee80211_hw *hw) rtlpriv->dm.disable_framebursting = false; rtlpriv->dm.thermalvalue =0 ; rtlpriv->dbg.global_debuglevel = rtlpriv->cfg->mod_params->debug; rtlpriv->rtlhal.pfirmware =vmalloc (0x4000 ); -if (!rtlpriv->rtlhal.pfirmware) { -RT_TRACE (rtlpriv,COMP_ERR ,DBG_EMERG , -"Can't alloc buffer for fw\n" ); +if (!rtlpriv->rtlhal.pfirmware)return 1 ; - } +/* request fw */ err =request_firmware (&firmware, rtlpriv->cfg->fw_name, rtlpriv->io.dev);if (err) {
drivers/net/wireless/rtlwifi/rtl8192de/sw.c +1 -4
@@ -171,13 +171,10 @@ static int rtl92d_init_sw_vars(struct ieee80211_hw *hw) rtlpriv->psc.fwctrl_psmode =FW_PS_DTIM_MODE ;/* for firmware buf */ rtlpriv->rtlhal.pfirmware =vzalloc (0x8000 ); -if (!rtlpriv->rtlhal.pfirmware) { -RT_TRACE (rtlpriv,COMP_ERR ,DBG_EMERG , -"Can't alloc buffer for fw\n" ); +if (!rtlpriv->rtlhal.pfirmware)return 1 ; - }if (!header_print) {pr_info ("Driver for Realtek RTL8192DE WLAN interface\n" );pr_info ("Loading firmware file %s\n" , rtlpriv->cfg->fw_name);
drivers/net/wireless/rtlwifi/rtl8192se/sw.c +1 -4
@@ -185,13 +185,10 @@ static int rtl92s_init_sw_vars(struct ieee80211_hw *hw) rtlpriv->psc.fwctrl_psmode =FW_PS_DTIM_MODE ;/* for firmware buf */ rtlpriv->rtlhal.pfirmware =vzalloc (sizeof (struct rt_firmware )); -if (!rtlpriv->rtlhal.pfirmware) { -RT_TRACE (rtlpriv,COMP_ERR ,DBG_EMERG , -"Can't alloc buffer for fw\n" ); +if (!rtlpriv->rtlhal.pfirmware)return 1 ; - }pr_info ("Driver for Realtek RTL8192SE/RTL8191SE\n" "Loading firmware %s\n" , rtlpriv->cfg->fw_name);/* request fw */
drivers/net/xen-netback/netback.c +1 -3
@@ -1638,12 +1638,10 @@ static int __init netback_init(void)return -ENODEV ; xen_netbk_group_nr =num_online_cpus (); xen_netbk =vzalloc (sizeof (struct xen_netbk ) * xen_netbk_group_nr); -if (!xen_netbk) { -printk (KERN_ALERT "%s: out of memory\n" , __func__); +if (!xen_netbk)return -ENOMEM ; - }for (group =0 ; group < xen_netbk_group_nr; group++) {struct xen_netbk *netbk = &xen_netbk[group];skb_queue_head_init (&netbk->rx_queue);
PATCH 1/1 drivers/net: Remove alloc_etherdev error messages
alloc_etherdev has a generic OOM/unable to alloc message. Remove the duplicative messages after alloc_etherdev calls.
---
Compiled x86 only.
drivers/net/ethernet/3com/3c59x.c | 5 ++--- drivers/net/ethernet/adaptec/starfire.c | 5 ++--- drivers/net/ethernet/adi/bfin_mac.c | 4 +--- drivers/net/ethernet/alteon/acenic.c | 5 +---- drivers/net/ethernet/amd/amd8111e.c | 1 - drivers/net/ethernet/amd/au1000_eth.c | 1 - drivers/net/ethernet/amd/declance.c | 2 -- drivers/net/ethernet/amd/pcnet32.c | 2 -- drivers/net/ethernet/apple/bmac.c | 4 +--- drivers/net/ethernet/apple/mace.c | 1 - drivers/net/ethernet/atheros/atl1c/atl1c_main.c | 1 - drivers/net/ethernet/atheros/atl1e/atl1e_main.c | 1 - drivers/net/ethernet/broadcom/b44.c | 1 - drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c | 4 +--- drivers/net/ethernet/broadcom/sb1250-mac.c | 2 -- drivers/net/ethernet/broadcom/tg3.c | 1 - drivers/net/ethernet/brocade/bna/bnad.c | 1 - drivers/net/ethernet/cadence/macb.c | 4 +--- .../net/ethernet/chelsio/cxgb4vf/cxgb4vf_main.c | 2 -- drivers/net/ethernet/cisco/enic/enic_main.c | 4 +--- drivers/net/ethernet/davicom/dm9000.c | 4 +--- drivers/net/ethernet/dec/tulip/tulip_core.c | 4 +--- drivers/net/ethernet/dec/tulip/xircom_cb.c | 5 ++--- drivers/net/ethernet/dnet.c | 4 +--- drivers/net/ethernet/ethoc.c | 1 - drivers/net/ethernet/hp/hp100.c | 1 - drivers/net/ethernet/ibm/ehea/ehea_main.c | 1 - drivers/net/ethernet/ibm/emac/core.c | 6 ++---- drivers/net/ethernet/ibm/iseries_veth.c | 4 +--- drivers/net/ethernet/icplus/ipg.c | 1 - drivers/net/ethernet/intel/e100.c | 5 +---- drivers/net/ethernet/jme.c | 1 - drivers/net/ethernet/korina.c | 5 ++--- drivers/net/ethernet/lantiq_etop.c | 4 ++++ drivers/net/ethernet/marvell/skge.c | 4 +--- drivers/net/ethernet/marvell/sky2.c | 4 +--- drivers/net/ethernet/mellanox/mlx4/en_netdev.c | 4 +--- drivers/net/ethernet/micrel/ks8695net.c | 4 +--- drivers/net/ethernet/micrel/ks8851.c | 4 +--- drivers/net/ethernet/microchip/enc28j60.c | 3 --- drivers/net/ethernet/myricom/myri10ge/myri10ge.c | 4 +--- drivers/net/ethernet/neterion/s2io.c | 1 - drivers/net/ethernet/netx-eth.c | 1 - .../net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c | 2 -- drivers/net/ethernet/packetengines/yellowfin.c | 5 ++--- drivers/net/ethernet/pasemi/pasemi_mac.c | 2 -- .../net/ethernet/qlogic/netxen/netxen_nic_main.c | 1 - drivers/net/ethernet/qlogic/qla3xxx.c | 1 - drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c | 1 - drivers/net/ethernet/rdc/r6040.c | 1 - drivers/net/ethernet/realtek/8139too.c | 5 ++--- drivers/net/ethernet/realtek/r8169.c | 2 -- drivers/net/ethernet/renesas/sh_eth.c | 1 - drivers/net/ethernet/s6gmac.c | 6 +++--- drivers/net/ethernet/seeq/sgiseeq.c | 1 - drivers/net/ethernet/sis/sis190.c | 2 -- drivers/net/ethernet/smsc/epic100.c | 5 ++--- drivers/net/ethernet/smsc/smc911x.c | 1 - drivers/net/ethernet/smsc/smc91x.c | 1 - drivers/net/ethernet/smsc/smsc911x.c | 1 - drivers/net/ethernet/smsc/smsc9420.c | 4 +--- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 4 +--- drivers/net/ethernet/sun/cassini.c | 1 - drivers/net/ethernet/sun/niu.c | 4 +--- drivers/net/ethernet/sun/sungem.c | 1 - drivers/net/ethernet/sun/sunvnet.c | 4 +--- drivers/net/ethernet/tehuti/tehuti.c | 1 - drivers/net/ethernet/ti/cpmac.c | 5 +---- drivers/net/ethernet/ti/davinci_emac.c | 1 - drivers/net/ethernet/ti/tlan.c | 1 - drivers/net/ethernet/toshiba/tc35815.c | 5 ++--- drivers/net/ethernet/tundra/tsi108_eth.c | 4 +--- drivers/net/ethernet/via/via-rhine.c | 1 - drivers/net/ethernet/via/via-velocity.c | 4 +--- drivers/net/ethernet/xilinx/ll_temac_main.c | 5 ++--- drivers/net/ethernet/xilinx/xilinx_axienet_main.c | 4 +--- drivers/net/ethernet/xilinx/xilinx_emaclite.c | 4 +--- drivers/net/plip/plip.c | 4 +--- drivers/net/rionet.c | 2 -- drivers/net/usb/pegasus.c | 4 +--- drivers/net/usb/rtl8150.c | 4 +--- drivers/net/usb/usbnet.c | 4 +--- drivers/net/vmxnet3/vmxnet3_drv.c | 5 +---- drivers/net/wireless/atmel.c | 5 ++--- drivers/net/wireless/ipw2x00/libipw_module.c | 5 ++--- drivers/net/xen-netfront.c | 5 +---- 86 files changed, 63 insertions(+), 192 deletions(-)
drivers/net/ethernet/3com/3c59x.c +2 -3
@@ -1121,10 +1121,9 @@ static int __devinit vortex_probe1(struct device *gendev, dev =alloc_etherdev (sizeof (*vp)); retval = -ENOMEM ; -if (!dev) { -pr_err (PFX "unable to allocate etherdev, aborting\n" ); +if (!dev) goto out; - } +SET_NETDEV_DEV (dev, gendev); vp =netdev_priv (dev);
drivers/net/ethernet/adaptec/starfire.c +2 -3
@@ -686,10 +686,9 @@ static int __devinit starfire_init_one(struct pci_dev *pdev, } dev =alloc_etherdev (sizeof (*np)); -if (!dev) { - printk(KERN_ERR DRV_NAME " %d: cannot alloc etherdev, aborting\n", card_idx); +if (!dev)return -ENOMEM ; - } +SET_NETDEV_DEV (dev, &pdev->dev); irq = pdev->irq;
drivers/net/ethernet/adi/bfin_mac.c +1 -3
@@ -1467,10 +1467,8 @@ static int __devinit bfin_mac_probe(struct platform_device *pdev)int rc; ndev =alloc_etherdev (sizeof (struct bfin_mac_local )); -if (!ndev) { -dev_err (&pdev->dev,"Cannot allocate net device!\n" ); +if (!ndev)return -ENOMEM ; - }SET_NETDEV_DEV (ndev, &pdev->dev);platform_set_drvdata (pdev, ndev);
drivers/net/ethernet/alteon/acenic.c +1 -4
@@ -463,11 +463,8 @@ static int __devinit acenic_probe_one(struct pci_dev *pdev,static int boards_found; dev =alloc_etherdev (sizeof (struct ace_private )); -if (dev ==NULL ) { -printk (KERN_ERR "acenic: Unable to allocate " -"net_device structure!\n" ); +if (dev ==NULL )return -ENOMEM ; - }SET_NETDEV_DEV (dev, &pdev->dev);
drivers/net/ethernet/amd/amd8111e.c +0 -1
@@ -1859,7 +1859,6 @@ static int __devinit amd8111e_probe_one(struct pci_dev *pdev, dev =alloc_etherdev (sizeof (struct amd8111e_priv ));if (!dev) { -printk (KERN_ERR "amd8111e: Etherdev alloc failed, exiting.\n" ); err = -ENOMEM ; goto err_free_reg; }
drivers/net/ethernet/amd/au1000_eth.c +0 -1
@@ -1077,7 +1077,6 @@ static int __devinit au1000_probe(struct platform_device *pdev) dev =alloc_etherdev (sizeof (struct au1000_private ));if (!dev) { -dev_err (&pdev->dev,"alloc_etherdev failed\n" ); err = -ENOMEM ; goto err_alloc; }
drivers/net/ethernet/amd/declance.c +0 -2
@@ -1052,8 +1052,6 @@ static int __devinit dec_lance_probe(struct device *bdev, const int type) dev =alloc_etherdev (sizeof (struct lance_private ));if (!dev) { -printk (KERN_ERR "%s: Unable to allocate etherdev, aborting.\n" , - name); ret = -ENOMEM ; goto err_out; }
drivers/net/ethernet/amd/pcnet32.c +0 -2
@@ -1649,8 +1649,6 @@ pcnet32_probe1(unsigned long ioaddr, int shared, struct pci_dev *pdev) dev =alloc_etherdev (sizeof (*lp));if (!dev) { -if (pcnet32_debug &NETIF_MSG_PROBE ) -pr_err ("Memory allocation failed\n" ); ret = -ENOMEM ; goto err_release_region; }
drivers/net/ethernet/apple/bmac.c +1 -3
@@ -1269,10 +1269,8 @@ static int __devinit bmac_probe(struct macio_dev *mdev, const struct of_device_imemcpy (addr, prop_addr,sizeof (addr)); dev =alloc_etherdev (PRIV_BYTES ); -if (!dev) { -printk (KERN_ERR "BMAC: alloc_etherdev failed, out of memory\n" ); +if (!dev)return -ENOMEM ; - } bp =netdev_priv (dev);SET_NETDEV_DEV (dev, &mdev->ofdev.dev);
drivers/net/ethernet/apple/mace.c +0 -1
@@ -147,7 +147,6 @@ static int __devinit mace_probe(struct macio_dev *mdev, const struct of_device_i dev =alloc_etherdev (PRIV_BYTES );if (!dev) { -printk (KERN_ERR "MACE: can't allocate ethernet device !\n" ); rc = -ENOMEM ; goto err_release; }
drivers/net/ethernet/atheros/atl1c/atl1c_main.c +0 -1
@@ -2689,7 +2689,6 @@ static int __devinit atl1c_probe(struct pci_dev *pdev, netdev =alloc_etherdev (sizeof (struct atl1c_adapter ));if (netdev ==NULL ) { err = -ENOMEM ; -dev_err (&pdev->dev,"etherdev alloc failed\n" ); goto err_alloc_etherdev; }
drivers/net/ethernet/atheros/atl1e/atl1e_main.c +0 -1
@@ -2300,7 +2300,6 @@ static int __devinit atl1e_probe(struct pci_dev *pdev, netdev =alloc_etherdev (sizeof (struct atl1e_adapter ));if (netdev ==NULL ) { err = -ENOMEM ; -dev_err (&pdev->dev,"etherdev alloc failed\n" ); goto err_alloc_etherdev; }
drivers/net/ethernet/broadcom/b44.c +0 -1
@@ -2138,7 +2138,6 @@ static int __devinit b44_init_one(struct ssb_device *sdev, dev =alloc_etherdev (sizeof (*bp));if (!dev) { -dev_err (sdev->dev,"Etherdev alloc failed, aborting\n" ); err = -ENOMEM ; goto out; }
drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c +1 -3
@@ -11133,10 +11133,8 @@ static int __devinit bnx2x_init_one(struct pci_dev *pdev,/* dev zeroed in init_etherdev */ dev =alloc_etherdev_mqs (sizeof (*bp), tx_count, rx_count); -if (!dev) { -dev_err (&pdev->dev,"Cannot allocate net device\n" ); +if (!dev)return -ENOMEM ; - } bp =netdev_priv (dev);
drivers/net/ethernet/broadcom/sb1250-mac.c +0 -2
@@ -2623,8 +2623,6 @@ static int __devinit sbmac_probe(struct platform_device *pldev)*/ dev =alloc_etherdev (sizeof (struct sbmac_softc ));if (!dev) { -printk (KERN_ERR "%s: unable to allocate etherdev\n" , -dev_name (&pldev->dev)); err = -ENOMEM ; goto out_unmap; }
drivers/net/ethernet/broadcom/tg3.c +0 -1
@@ -15471,7 +15471,6 @@ static int __devinit tg3_init_one(struct pci_dev *pdev, dev =alloc_etherdev_mq (sizeof (*tp),TG3_IRQ_MAX_VECS );if (!dev) { -dev_err (&pdev->dev,"Etherdev alloc failed, aborting\n" ); err = -ENOMEM ; goto err_out_power_down; }
drivers/net/ethernet/brocade/bna/bnad.c +0 -1
@@ -3284,7 +3284,6 @@ bnad_pci_probe(struct pci_dev *pdev,*/ netdev =alloc_etherdev (sizeof (struct bnad ));if (!netdev) { -dev_err (&pdev->dev,"netdev allocation failed\n" ); err = -ENOMEM ;return err; }
drivers/net/ethernet/cadence/macb.c +1 -3
@@ -1308,10 +1308,8 @@ static int __init macb_probe(struct platform_device *pdev) err = -ENOMEM ; dev =alloc_etherdev (sizeof (*bp)); -if (!dev) { -dev_err (&pdev->dev,"etherdev alloc failed, aborting.\n" ); +if (!dev) goto err_out; - }SET_NETDEV_DEV (dev, &pdev->dev);
drivers/net/ethernet/chelsio/cxgb4vf/cxgb4vf_main.c +0 -2
@@ -2596,8 +2596,6 @@ static int __devinit cxgb4vf_pci_probe(struct pci_dev *pdev, netdev =alloc_etherdev_mq (sizeof (struct port_info ),MAX_PORT_QSETS );if (netdev ==NULL ) { -dev_err (&pdev->dev,"cannot allocate netdev for" -" port %d\n" , port_id);t4vf_free_vi (adapter, viid); err = -ENOMEM ; goto err_free_dev;
drivers/net/ethernet/cisco/enic/enic_main.c +1 -3
@@ -2280,10 +2280,8 @@ static int __devinit enic_probe(struct pci_dev *pdev,*/ netdev =alloc_etherdev (sizeof (struct enic )); -if (!netdev) { -pr_err ("Etherdev alloc failed, aborting\n" ); +if (!netdev)return -ENOMEM ; - }pci_set_drvdata (pdev, netdev);
drivers/net/ethernet/davicom/dm9000.c +1 -3
@@ -1373,10 +1373,8 @@ dm9000_probe(struct platform_device *pdev)/* Init network device */ ndev =alloc_etherdev (sizeof (struct board_info )); -if (!ndev) { -dev_err (&pdev->dev,"could not allocate device.\n" ); +if (!ndev)return -ENOMEM ; - }SET_NETDEV_DEV (ndev, &pdev->dev);
drivers/net/ethernet/dec/tulip/tulip_core.c +1 -3
@@ -1424,10 +1424,8 @@ static int __devinit tulip_init_one (struct pci_dev *pdev,/* alloc_etherdev ensures aligned and zeroed private structures */ dev =alloc_etherdev (sizeof (*tp)); -if (!dev) { -pr_err ("ether device alloc failed, aborting\n" ); +if (!dev)return -ENOMEM ; - }SET_NETDEV_DEV (dev, &pdev->dev);if (pci_resource_len (pdev,0 ) < tulip_tbl[chip_idx].io_size) {
drivers/net/ethernet/dec/tulip/xircom_cb.c +2 -3
@@ -222,10 +222,9 @@ static int __devinit xircom_probe(struct pci_dev *pdev, const struct pci_device_is available. */ dev =alloc_etherdev (sizeof (struct xircom_private )); -if (!dev) { -pr_err ("%s: failed to allocate etherdev\n" , __func__); +if (!dev) goto device_fail; - } + private =netdev_priv (dev);/* Allocate the send/receive buffers */
drivers/net/ethernet/dnet.c +1 -3
@@ -854,10 +854,8 @@ static int __devinit dnet_probe(struct platform_device *pdev) err = -ENOMEM ; dev =alloc_etherdev (sizeof (*bp)); -if (!dev) { -dev_err (&pdev->dev,"etherdev alloc failed, aborting.\n" ); +if (!dev) goto err_out_release_mem; - }/* TODO: Actually, we have some interesting features... */ dev->features |=0 ;
drivers/net/ethernet/ethoc.c +0 -1
@@ -913,7 +913,6 @@ static int __devinit ethoc_probe(struct platform_device *pdev)/* allocate networking device */ netdev =alloc_etherdev (sizeof (struct ethoc ));if (!netdev) { -dev_err (&pdev->dev,"cannot allocate network device\n" ); ret = -ENOMEM ; goto out; }
drivers/net/ethernet/hp/hp100.c +0 -1
@@ -2992,7 +2992,6 @@ static int __init hp100_isa_init(void)for (i =0 ; i <HP100_DEVICES && hp100_port[i] !=-1 ; ++i) { dev =alloc_etherdev (sizeof (struct hp100_private ));if (!dev) { -printk (KERN_WARNING "hp100: no memory for network device\n" );while (cards >0 )cleanup_dev (hp100_devlist[--cards]);
drivers/net/ethernet/ibm/ehea/ehea_main.c +0 -1
@@ -2980,7 +2980,6 @@ static struct ehea_port *ehea_setup_single_port(struct ehea_adapter *adapter, dev =alloc_etherdev_mq (sizeof (struct ehea_port ),EHEA_MAX_PORT_RES );if (!dev) { -pr_err ("no mem for net_device\n" ); ret = -ENOMEM ; goto out_err; }
drivers/net/ethernet/ibm/emac/core.c +2 -4
@@ -2706,11 +2706,9 @@ static int __devinit emac_probe(struct platform_device *ofdev)/* Allocate our net_device structure */ err = -ENOMEM ; ndev =alloc_etherdev (sizeof (struct emac_instance )); -if (!ndev) { -printk (KERN_ERR "%s: could not allocate ethernet device!\n" , - np->full_name); +if (!ndev) goto err_gone; - } + dev =netdev_priv (ndev); dev->ndev = ndev; dev->ofdev = ofdev;
drivers/net/ethernet/ibm/iseries_veth.c +1 -3
@@ -1032,10 +1032,8 @@ static struct net_device *veth_probe_one(int vlan, } dev =alloc_etherdev (sizeof (struct veth_port )); -if (! dev) { -veth_error ("Unable to allocate net_device structure!\n" ); +if (!dev)return NULL ; - } port =netdev_priv (dev);
drivers/net/ethernet/icplus/ipg.c +0 -1
@@ -2233,7 +2233,6 @@ static int __devinit ipg_probe(struct pci_dev *pdev,*/ dev =alloc_etherdev (sizeof (struct ipg_nic_private ));if (!dev) { -pr_err ("%s: alloc_etherdev failed\n" ,pci_name (pdev)); rc = -ENOMEM ; goto err_disable_0; }
drivers/net/ethernet/intel/e100.c +1 -4
@@ -2751,11 +2751,8 @@ static int __devinit e100_probe(struct pci_dev *pdev,struct nic *nic;int err; -if (!(netdev =alloc_etherdev (sizeof (struct nic )))) { -if (((1 << debug) -1 ) &NETIF_MSG_PROBE ) -pr_err ("Etherdev alloc failed, aborting\n" ); +if (!(netdev =alloc_etherdev (sizeof (struct nic ))))return -ENOMEM ; - } netdev->netdev_ops = &e100_netdev_ops;SET_ETHTOOL_OPS (netdev, &e100_ethtool_ops);
drivers/net/ethernet/jme.c +0 -1
@@ -2999,7 +2999,6 @@ jme_init_one(struct pci_dev *pdev,*/ netdev =alloc_etherdev (sizeof (*jme));if (!netdev) { -pr_err ("Cannot allocate netdev structure\n" ); rc = -ENOMEM ; goto err_out_release_regions; }
drivers/net/ethernet/korina.c +2 -3
@@ -1108,10 +1108,9 @@ static int korina_probe(struct platform_device *pdev)int rc; dev =alloc_etherdev (sizeof (struct korina_private )); -if (!dev) { - printk(KERN_ERR DRV_NAME ": alloc_etherdev failed\n"); +if (!dev)return -ENOMEM ; - } +SET_NETDEV_DEV (dev, &pdev->dev); lp =netdev_priv (dev);
drivers/net/ethernet/lantiq_etop.c +4 -0
@@ -876,6 +876,10 @@ ltq_etop_probe(struct platform_device *pdev) } dev =alloc_etherdev_mq (sizeof (struct ltq_etop_priv ),4 ); +if (!dev) { + err = -ENOMEM ; + goto err_out; + }strcpy (dev->name,"eth%d" ); dev->netdev_ops = <q_eth_netdev_ops; priv =netdev_priv (dev);
drivers/net/ethernet/marvell/skge.c +1 -3
@@ -3852,10 +3852,8 @@ static struct net_device *skge_devinit(struct skge_hw *hw, int port,struct skge_port *skge;struct net_device *dev =alloc_etherdev (sizeof (*skge)); -if (!dev) { -dev_err (&hw->pdev->dev,"etherdev alloc failed\n" ); +if (!dev)return NULL ; - }SET_NETDEV_DEV (dev, &hw->pdev->dev); dev->netdev_ops = &skge_netdev_ops;
drivers/net/ethernet/marvell/sky2.c +1 -3
@@ -4700,10 +4700,8 @@ static __devinit struct net_device *sky2_init_netdev(struct sky2_hw *hw,struct sky2_port *sky2;struct net_device *dev =alloc_etherdev (sizeof (*sky2)); -if (!dev) { -dev_err (&hw->pdev->dev,"etherdev alloc failed\n" ); +if (!dev)return NULL ; - }SET_NETDEV_DEV (dev, &hw->pdev->dev); dev->irq = hw->pdev->irq;
drivers/net/ethernet/mellanox/mlx4/en_netdev.c +1 -3
@@ -1047,10 +1047,8 @@ int mlx4_en_init_netdev(struct mlx4_en_dev *mdev, int port, dev =alloc_etherdev_mqs (sizeof (struct mlx4_en_priv ), prof->tx_ring_num, prof->rx_ring_num); -if (dev ==NULL ) { -mlx4_err (mdev,"Net device allocation failed\n" ); +if (dev ==NULL )return -ENOMEM ; - }SET_NETDEV_DEV (dev, &mdev->dev->pdev->dev); dev->dev_id = port -1 ;
drivers/net/ethernet/micrel/ks8695net.c +1 -3
@@ -1362,10 +1362,8 @@ ks8695_probe(struct platform_device *pdev)/* Initialise a net_device */ ndev =alloc_etherdev (sizeof (struct ks8695_priv )); -if (!ndev) { -dev_err (&pdev->dev,"could not allocate device.\n" ); +if (!ndev)return -ENOMEM ; - }SET_NETDEV_DEV (ndev, &pdev->dev);
drivers/net/ethernet/micrel/ks8851.c +1 -3
@@ -1419,10 +1419,8 @@ static int __devinit ks8851_probe(struct spi_device *spi)int ret; ndev =alloc_etherdev (sizeof (struct ks8851_net )); -if (!ndev) { -dev_err (&spi->dev,"failed to alloc ethernet device\n" ); +if (!ndev)return -ENOMEM ; - } spi->bits_per_word =8 ;
drivers/net/ethernet/microchip/enc28j60.c +0 -3
@@ -1553,9 +1553,6 @@ static int __devinit enc28j60_probe(struct spi_device *spi) dev =alloc_etherdev (sizeof (struct enc28j60_net ));if (!dev) { -if (netif_msg_drv (&debug)) -dev_err (&spi->dev,DRV_NAME -": unable to alloc new ethernet\n" ); ret = -ENOMEM ; goto error_alloc; }
drivers/net/ethernet/myricom/myri10ge/myri10ge.c +1 -3
@@ -3910,10 +3910,8 @@ static int myri10ge_probe(struct pci_dev *pdev, const struct pci_device_id *ent)static int board_number; netdev =alloc_etherdev_mq (sizeof (*mgp),MYRI10GE_MAX_SLICES ); -if (netdev ==NULL ) { -dev_err (dev,"Could not allocate ethernet device\n" ); +if (netdev ==NULL )return -ENOMEM ; - }SET_NETDEV_DEV (netdev, &pdev->dev);
drivers/net/ethernet/neterion/s2io.c +0 -1
@@ -7760,7 +7760,6 @@ s2io_init_nic(struct pci_dev *pdev, const struct pci_device_id *pre)else dev =alloc_etherdev (sizeof (struct s2io_nic ));if (dev ==NULL ) { -DBG_PRINT (ERR_DBG ,"Device allocation failed\n" );pci_disable_device (pdev);pci_release_regions (pdev);return -ENODEV ;
drivers/net/ethernet/netx-eth.c +0 -1
@@ -383,7 +383,6 @@ static int netx_eth_drv_probe(struct platform_device *pdev) ndev =alloc_etherdev (sizeof (struct netx_eth_priv ));if (!ndev) { -printk ("%s: could not allocate device.\n" ,CARDNAME ); ret = -ENOMEM ; goto exit; }
drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c +0 -2
@@ -2419,8 +2419,6 @@ static int pch_gbe_probe(struct pci_dev *pdev, netdev =alloc_etherdev ((int )sizeof (struct pch_gbe_adapter ));if (!netdev) { ret = -ENOMEM ; -dev_err (&pdev->dev, -"ERR: Can't allocate and set up an Ethernet device\n" ); goto err_release_pci; }SET_NETDEV_DEV (netdev, &pdev->dev);
drivers/net/ethernet/packetengines/yellowfin.c +2 -3
@@ -397,10 +397,9 @@ static int __devinit yellowfin_init_one(struct pci_dev *pdev,if (i)return i; dev =alloc_etherdev (sizeof (*np)); -if (!dev) { -pr_err ("cannot allocate ethernet device\n" ); +if (!dev)return -ENOMEM ; - } +SET_NETDEV_DEV (dev, &pdev->dev); np =netdev_priv (dev);
drivers/net/ethernet/pasemi/pasemi_mac.c +0 -2
@@ -1740,8 +1740,6 @@ pasemi_mac_probe(struct pci_dev *pdev, const struct pci_device_id *ent) dev =alloc_etherdev (sizeof (struct pasemi_mac ));if (dev ==NULL ) { -dev_err (&pdev->dev, -"pasemi_mac: Could not allocate ethernet device.\n" ); err = -ENOMEM ; goto out_disable_device; }
drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c +0 -1
@@ -1403,7 +1403,6 @@ netxen_nic_probe(struct pci_dev *pdev, const struct pci_device_id *ent) netdev =alloc_etherdev (sizeof (struct netxen_adapter ));if (!netdev) { -dev_err (&pdev->dev,"failed to allocate net_device\n" ); err = -ENOMEM ; goto err_out_free_res; }
drivers/net/ethernet/qlogic/qla3xxx.c +0 -1
@@ -3805,7 +3805,6 @@ static int __devinit ql3xxx_probe(struct pci_dev *pdev, ndev =alloc_etherdev (sizeof (struct ql3_adapter ));if (!ndev) { -pr_err ("%s could not alloc etherdev\n" ,pci_name (pdev)); err = -ENOMEM ; goto err_out_free_regions; }
drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c +0 -1
@@ -1576,7 +1576,6 @@ qlcnic_probe(struct pci_dev *pdev, const struct pci_device_id *ent) netdev =alloc_etherdev (sizeof (struct qlcnic_adapter ));if (!netdev) { -dev_err (&pdev->dev,"failed to allocate net_device\n" ); err = -ENOMEM ; goto err_out_free_res; }
drivers/net/ethernet/rdc/r6040.c +0 -1
@@ -1107,7 +1107,6 @@ static int __devinit r6040_init_one(struct pci_dev *pdev, dev =alloc_etherdev (sizeof (struct r6040_private ));if (!dev) { -dev_err (&pdev->dev,"Failed to allocate etherdev\n" ); err = -ENOMEM ; goto err_out; }
drivers/net/ethernet/realtek/8139too.c +2 -3
@@ -754,10 +754,9 @@ static __devinit struct net_device * rtl8139_init_board (struct pci_dev *pdev)/* dev and priv zeroed in alloc_etherdev */ dev =alloc_etherdev (sizeof (*tp)); -if (dev ==NULL ) { -dev_err (&pdev->dev,"Unable to alloc new net device\n" ); +if (dev ==NULL )return ERR_PTR (-ENOMEM ); - } +SET_NETDEV_DEV (dev, &pdev->dev); tp =netdev_priv (dev);
drivers/net/ethernet/realtek/r8169.c +0 -2
@@ -3958,8 +3958,6 @@ rtl8169_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) dev =alloc_etherdev (sizeof (*tp));if (!dev) { -if (netif_msg_drv (&debug)) -dev_err (&pdev->dev,"unable to alloc new ethernet\n" ); rc = -ENOMEM ; goto out; }
drivers/net/ethernet/renesas/sh_eth.c +0 -1
@@ -1792,7 +1792,6 @@ static int sh_eth_drv_probe(struct platform_device *pdev) ndev =alloc_etherdev (sizeof (struct sh_eth_private ));if (!ndev) { -dev_err (&pdev->dev,"Could not allocate device.\n" ); ret = -ENOMEM ; goto out; }
drivers/net/ethernet/s6gmac.c +3 -3
@@ -960,11 +960,11 @@ static int __devinit s6gmac_probe(struct platform_device *pdev)int res;unsigned long i;struct mii_bus *mb; + dev =alloc_etherdev (sizeof (*pd)); -if (!dev) { - printk(KERN_ERR DRV_PRMT "etherdev alloc failed, aborting.\n"); +if (!dev)return -ENOMEM ; - } + dev->open = s6gmac_open; dev->stop = s6gmac_stop; dev->hard_start_xmit = s6gmac_tx;
drivers/net/ethernet/seeq/sgiseeq.c +0 -1
@@ -733,7 +733,6 @@ static int __devinit sgiseeq_probe(struct platform_device *pdev) dev =alloc_etherdev (sizeof (struct sgiseeq_private ));if (!dev) { -printk (KERN_ERR "Sgiseeq: Etherdev alloc failed, aborting.\n" ); err = -ENOMEM ; goto err_out; }
drivers/net/ethernet/sis/sis190.c +0 -2
@@ -1462,8 +1462,6 @@ static struct net_device * __devinit sis190_init_board(struct pci_dev *pdev) dev =alloc_etherdev (sizeof (*tp));if (!dev) { -if (netif_msg_drv (&debug)) -pr_err ("unable to alloc new ethernet\n" ); rc = -ENOMEM ; goto err_out_0; }
drivers/net/ethernet/smsc/epic100.c +2 -3
@@ -363,10 +363,9 @@ static int __devinit epic_init_one (struct pci_dev *pdev, ret = -ENOMEM ; dev =alloc_etherdev (sizeof (*ep)); -if (!dev) { -dev_err (&pdev->dev,"no memory for eth device\n" ); +if (!dev) goto err_out_free_res; - } +SET_NETDEV_DEV (dev, &pdev->dev);#ifdef USE_IO_OPS
drivers/net/ethernet/smsc/smc911x.c +0 -1
@@ -2065,7 +2065,6 @@ static int __devinit smc911x_drv_probe(struct platform_device *pdev) ndev =alloc_etherdev (sizeof (struct smc911x_local ));if (!ndev) { -printk ("%s: could not allocate device.\n" ,CARDNAME ); ret = -ENOMEM ; goto release_1; }
drivers/net/ethernet/smsc/smc91x.c +0 -1
@@ -2223,7 +2223,6 @@ static int __devinit smc_drv_probe(struct platform_device *pdev) ndev =alloc_etherdev (sizeof (struct smc_local ));if (!ndev) { -printk ("%s: could not allocate device.\n" ,CARDNAME ); ret = -ENOMEM ; goto out; }
drivers/net/ethernet/smsc/smsc911x.c +0 -1
@@ -2374,7 +2374,6 @@ static int __devinit smsc911x_drv_probe(struct platform_device *pdev) dev =alloc_etherdev (sizeof (struct smsc911x_data ));if (!dev) { -pr_warn ("Could not allocate device\n" ); retval = -ENOMEM ; goto out_release_io_1; }
drivers/net/ethernet/smsc/smsc9420.c +1 -3
@@ -1598,10 +1598,8 @@ smsc9420_probe(struct pci_dev *pdev, const struct pci_device_id *id)pci_set_master (pdev); dev =alloc_etherdev (sizeof (*pd)); -if (!dev) { -printk (KERN_ERR "ether device alloc failed\n" ); +if (!dev) goto out_disable_pci_device_1; - }SET_NETDEV_DEV (dev, &pdev->dev);
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +1 -3
@@ -1801,10 +1801,8 @@ struct stmmac_priv *stmmac_dvr_probe(struct device *device,struct stmmac_priv *priv; ndev =alloc_etherdev (sizeof (struct stmmac_priv )); -if (!ndev) { -pr_err ("%s: ERROR: allocating the device\n" , __func__); +if (!ndev)return NULL ; - }SET_NETDEV_DEV (ndev, device);
drivers/net/ethernet/sun/cassini.c +0 -1
@@ -4946,7 +4946,6 @@ static int __devinit cas_init_one(struct pci_dev *pdev, dev =alloc_etherdev (sizeof (*cp));if (!dev) { -dev_err (&pdev->dev,"Etherdev alloc failed, aborting\n" ); err = -ENOMEM ; goto err_out_disable_pdev; }
drivers/net/ethernet/sun/niu.c +1 -3
@@ -9685,10 +9685,8 @@ static struct net_device * __devinit niu_alloc_and_init(struct niu *np; dev =alloc_etherdev_mq (sizeof (struct niu ),NIU_NUM_TXCHAN ); -if (!dev) { -dev_err (gen_dev,"Etherdev alloc failed, aborting\n" ); +if (!dev)return NULL ; - }SET_NETDEV_DEV (dev, gen_dev);
drivers/net/ethernet/sun/sungem.c +0 -1
@@ -2885,7 +2885,6 @@ static int __devinit gem_init_one(struct pci_dev *pdev, dev =alloc_etherdev (sizeof (*gp));if (!dev) { -pr_err ("Etherdev alloc failed, aborting\n" ); err = -ENOMEM ; goto err_disable_device; }
drivers/net/ethernet/sun/sunvnet.c +1 -3
@@ -1026,10 +1026,8 @@ static struct vnet * __devinit vnet_new(const u64 *local_mac)int err, i; dev =alloc_etherdev (sizeof (*vp)); -if (!dev) { -pr_err ("Etherdev alloc failed, aborting\n" ); +if (!dev)return ERR_PTR (-ENOMEM ); - }for (i =0 ; i <ETH_ALEN ; i++) dev->dev_addr[i] = (*local_mac >> (5 - i) *8 ) &0xff ;
drivers/net/ethernet/tehuti/tehuti.c +0 -1
@@ -1978,7 +1978,6 @@ bdx_probe(struct pci_dev *pdev, const struct pci_device_id *ent) ndev =alloc_etherdev (sizeof (struct bdx_priv ));if (!ndev) { err = -ENOMEM ; -pr_err ("alloc_etherdev failed\n" ); goto err_out_iomap; }
drivers/net/ethernet/ti/cpmac.c +1 -4
@@ -1143,11 +1143,8 @@ static int __devinit cpmac_probe(struct platform_device *pdev) } dev =alloc_etherdev_mq (sizeof (*priv),CPMAC_QUEUES ); - -if (!dev) { -printk (KERN_ERR "cpmac: Unable to allocate net_device\n" ); +if (!dev)return -ENOMEM ; - }platform_set_drvdata (pdev, dev); priv =netdev_priv (dev);
drivers/net/ethernet/ti/davinci_emac.c +0 -1
@@ -1789,7 +1789,6 @@ static int __devinit davinci_emac_probe(struct platform_device *pdev) ndev =alloc_etherdev (sizeof (struct emac_priv ));if (!ndev) { -dev_err (&pdev->dev,"error allocating net_device\n" ); rc = -ENOMEM ; goto free_clk; }
drivers/net/ethernet/ti/tlan.c +0 -1
@@ -486,7 +486,6 @@ static int __devinit tlan_probe1(struct pci_dev *pdev, dev =alloc_etherdev (sizeof (struct tlan_priv ));if (dev ==NULL ) { -pr_err ("Could not allocate memory for device\n" ); rc = -ENOMEM ; goto err_out_regions; }
drivers/net/ethernet/toshiba/tc35815.c +2 -3
@@ -808,10 +808,9 @@ static int __devinit tc35815_init_one(struct pci_dev *pdev,/* dev zeroed in alloc_etherdev */ dev =alloc_etherdev (sizeof (*lp)); -if (dev ==NULL ) { -dev_err (&pdev->dev,"unable to alloc new ethernet\n" ); +if (dev ==NULL )return -ENOMEM ; - } +SET_NETDEV_DEV (dev, &pdev->dev); lp =netdev_priv (dev); lp->dev = dev;
drivers/net/ethernet/tundra/tsi108_eth.c +1 -3
@@ -1582,10 +1582,8 @@ tsi108_init_one(struct platform_device *pdev)/* Create an ethernet device instance */ dev =alloc_etherdev (sizeof (struct tsi108_prv_data )); -if (!dev) { -printk ("tsi108_eth: Could not allocate a device structure\n" ); +if (!dev)return -ENOMEM ; - }printk ("tsi108_eth%d: probe...\n" , pdev->id); data =netdev_priv (dev);
drivers/net/ethernet/via/via-rhine.c +0 -1
@@ -927,7 +927,6 @@ static int __devinit rhine_init_one(struct pci_dev *pdev, dev =alloc_etherdev (sizeof (struct rhine_private ));if (!dev) { rc = -ENOMEM ; -dev_err (&pdev->dev,"alloc_etherdev failed\n" ); goto err_out; }SET_NETDEV_DEV (dev, &pdev->dev);
drivers/net/ethernet/via/via-velocity.c +1 -3
@@ -2733,10 +2733,8 @@ static int __devinit velocity_found1(struct pci_dev *pdev, const struct pci_devi } dev =alloc_etherdev (sizeof (struct velocity_info )); -if (!dev) { -dev_err (&pdev->dev,"allocate net device failed.\n" ); +if (!dev) goto out; - }/* Chain it all together */
drivers/net/ethernet/xilinx/ll_temac_main.c +2 -3
@@ -1011,10 +1011,9 @@ static int __devinit temac_of_probe(struct platform_device *op)/* Init network device structure */ ndev =alloc_etherdev (sizeof (*lp)); -if (!ndev) { -dev_err (&op->dev,"could not allocate device.\n" ); +if (!ndev)return -ENOMEM ; - } +ether_setup (ndev);dev_set_drvdata (&op->dev, ndev);SET_NETDEV_DEV (ndev, &op->dev);
drivers/net/ethernet/xilinx/xilinx_axienet_main.c +1 -3
@@ -1486,10 +1486,8 @@ static int __devinit axienet_of_probe(struct platform_device *op)const void *addr; ndev =alloc_etherdev (sizeof (*lp)); -if (!ndev) { -dev_err (&op->dev,"could not allocate device.\n" ); +if (!ndev)return -ENOMEM ; - }ether_setup (ndev);dev_set_drvdata (&op->dev, ndev);
drivers/net/ethernet/xilinx/xilinx_emaclite.c +1 -3
@@ -1136,10 +1136,8 @@ static int __devinit xemaclite_of_probe(struct platform_device *ofdev)/* Create an ethernet device instance */ ndev =alloc_etherdev (sizeof (struct net_local )); -if (!ndev) { -dev_err (dev,"Could not allocate network device\n" ); +if (!ndev)return -ENOMEM ; - }dev_set_drvdata (dev, ndev);SET_NETDEV_DEV (ndev, &ofdev->dev);
drivers/net/plip/plip.c +1 -3
@@ -1260,10 +1260,8 @@ static void plip_attach (struct parport *port)sprintf (name,"plip%d" , unit); dev =alloc_etherdev (sizeof (struct net_local )); -if (!dev) { -printk (KERN_ERR "plip: memory squeeze\n" ); +if (!dev)return ; - }strcpy (dev->name, name);
drivers/net/rionet.c +0 -2
@@ -497,8 +497,6 @@ static int rionet_probe(struct rio_dev *rdev, const struct rio_device_id *id)/* Allocate our net_device structure */ ndev =alloc_etherdev (sizeof (struct rionet_private ));if (ndev ==NULL ) { -printk (KERN_INFO "%s: could not allocate ethernet device.\n" , -DRV_NAME ); rc = -ENOMEM ; goto out; }
drivers/net/usb/pegasus.c +1 -3
@@ -1332,10 +1332,8 @@ static int pegasus_probe(struct usb_interface *intf,usb_get_dev (dev); net =alloc_etherdev (sizeof (struct pegasus )); -if (!net) { -dev_err (&intf->dev,"can't allocate %s\n" ,"device" ); +if (!net) goto out; - } pegasus =netdev_priv (net); pegasus->dev_index = dev_index;
drivers/net/usb/rtl8150.c +1 -3
@@ -894,10 +894,8 @@ static int rtl8150_probe(struct usb_interface *intf,struct net_device *netdev; netdev =alloc_etherdev (sizeof (rtl8150_t)); -if (!netdev) { -err ("Out of memory" ); +if (!netdev)return -ENOMEM ; - } dev =netdev_priv (netdev);
drivers/net/usb/usbnet.c +1 -3
@@ -1334,10 +1334,8 @@ usbnet_probe (struct usb_interface *udev, const struct usb_device_id *prod)// set up our own records net =alloc_etherdev (sizeof (*dev)); -if (!net) { -dbg ("can't kmalloc dev" ); +if (!net) goto out; - }/* netdev_printk() needs this so do it as early as possible */ SET_NETDEV_DEV (net, &udev->dev);
drivers/net/vmxnet3/vmxnet3_drv.c +1 -4
@@ -2918,11 +2918,8 @@ vmxnet3_probe_device(struct pci_dev *pdev,printk (KERN_INFO "# of Tx queues : %d, # of Rx queues : %d\n" , num_tx_queues, num_rx_queues); -if (!netdev) { -printk (KERN_ERR "Failed to alloc ethernet device for adapter " -"%s\n" ,pci_name (pdev)); +if (!netdev)return -ENOMEM ; - }pci_set_drvdata (pdev, netdev); adapter =netdev_priv (netdev);
drivers/net/wireless/atmel.c +2 -3
@@ -1533,10 +1533,9 @@ struct net_device *init_atmel_card(unsigned short irq, unsigned long port,/* Create the network device object. */ dev =alloc_etherdev (sizeof (*priv)); -if (!dev) { -printk (KERN_ERR "atmel: Couldn't alloc_etherdev\n" ); +if (!dev)return NULL ; - } +if (dev_alloc_name (dev, dev->name) <0 ) {printk (KERN_ERR "atmel: Couldn't get name!\n" ); goto err_out_free;
drivers/net/wireless/ipw2x00/libipw_module.c +2 -3
@@ -150,10 +150,9 @@ struct net_device *alloc_libipw(int sizeof_priv, int monitor)LIBIPW_DEBUG_INFO ("Initializing...\n" ); dev =alloc_etherdev (sizeof (struct libipw_device ) + sizeof_priv); -if (!dev) { -LIBIPW_ERROR ("Unable to allocate network device.\n" ); +if (!dev) goto failed; - } + ieee =netdev_priv (dev); ieee->dev = dev;
drivers/net/xen-netfront.c +1 -4
@@ -1279,11 +1279,8 @@ static struct net_device * __devinit xennet_create_dev(struct xenbus_device *devstruct netfront_info *np; netdev =alloc_etherdev (sizeof (struct netfront_info )); -if (!netdev) { -printk (KERN_WARNING "%s> alloc_etherdev failed.\n" , - __func__); +if (!netdev)return ERR_PTR (-ENOMEM ); - } np =netdev_priv (netdev); np->xbdev = dev;
Signature · 1 line
1.7.8.111.gad25c.dirty
PATCH 1/1 net: dev: Convert printks to pr_<level>
Use the current logging style.
Coalesce formats where appropriate.
Update grammar where appropriate.
--- net/core/dev.c | 101 +++++++++++++++++++++++++------------------------------ 1 files changed, 46 insertions(+), 55 deletions(-)
net/core/dev.c +46 -55
@@ -446,7 +446,7 @@ void __dev_remove_pack(struct packet_type *pt) } } -printk (KERN_WARNING "dev_remove_pack: %p not found.\n" , pt); +pr_warn ("dev_remove_pack: %p not found\n" , pt); out:spin_unlock (&ptype_lock); }
@@ -1039,8 +1039,7 @@ rollback:memcpy (dev->name, oldname,IFNAMSIZ ); goto rollback; }else { -printk (KERN_ERR -"%s: name change rollback failed: %d.\n" , +pr_err ("%s: name change rollback failed: %d\n" , dev->name, ret); } }
@@ -1139,9 +1138,10 @@ void dev_load(struct net *net, const char *name) no_module =request_module ("netdev-%s" , name);if (no_module &&capable (CAP_SYS_MODULE )) {if (!request_module ("%s" , name)) -pr_err ("Loading kernel module for a network device " -"with CAP_SYS_MODULE (deprecated). Use CAP_NET_ADMIN and alias netdev-%s " -"instead\n" , name); +pr_err ( +"Loading kernel module for a network device with CAP_SYS_MODULE (deprecated). " +"Use CAP_NET_ADMIN and alias netdev-%s instead\n" , + name); } }EXPORT_SYMBOL (dev_load);
@@ -1655,10 +1655,9 @@ static void dev_queue_xmit_nit(struct sk_buff *skb, struct net_device *dev)if (skb_network_header (skb2) < skb2->data || skb2->network_header > skb2->tail) {if (net_ratelimit ()) -printk (KERN_CRIT "protocol %04x is " -"buggy, dev %s\n" , -ntohs (skb2->protocol), - dev->name); +pr_crit ("protocol %04x is buggy, dev %s\n" , +ntohs (skb2->protocol), + dev->name);skb_reset_network_header (skb2); }
@@ -1691,9 +1690,9 @@ static void netif_setup_tc(struct net_device *dev, unsigned int txq)/* If TC0 is invalidated disable TC mapping */ if (tc->offset + tc->count > txq) { -pr_warning ("Number of in use tx queues changed " -"invalidating tc mappings. Priority " -"traffic classification disabled!\n" ); +pr_warn ( +"Number of in use tx queues changed invalidating tc mappings. " +"Priority traffic classification disabled!\n" ); dev->num_tc =0 ;return ; }
@@ -1704,11 +1703,9 @@ static void netif_setup_tc(struct net_device *dev, unsigned int txq) tc = &dev->tc_to_txq[q];if (tc->offset + tc->count > txq) { -pr_warning ("Number of in use tx queues " -"changed. Priority %i to tc " -"mapping %i is no longer valid " -"setting map to 0\n" , - i, q); +pr_warn ("Number of in use tx queues changed. " +"Priority %i to tc mapping %i is no longer valid. Setting map to 0\n" , + i, q);netdev_set_prio_tc_map (dev, i,0 ); } }
@@ -2014,8 +2011,7 @@ EXPORT_SYMBOL(skb_gso_segment);void netdev_rx_csum_fault (struct net_device *dev) {if (net_ratelimit ()) { -printk (KERN_ERR "%s: hw csum failure.\n" , - dev ? dev->name :"<unknown>" ); +pr_err ("%s: hw csum failure\n" , dev ? dev->name :"<unknown>" );dump_stack (); } }
@@ -2332,9 +2328,9 @@ static inline u16 dev_cap_txqueue(struct net_device *dev, u16 queue_index) {if (unlikely (queue_index >= dev->real_num_tx_queues)) {if (net_ratelimit ()) { -pr_warning ("%s selects TX queue %d, but " -"real number of TX queues is %d\n" , - dev->name, queue_index, dev->real_num_tx_queues); +pr_warn ("%s selects TX queue %d, but real number of TX queues is %d\n" , + dev->name, queue_index, + dev->real_num_tx_queues); }return 0 ; }
@@ -2578,16 +2574,16 @@ int dev_queue_xmit(struct sk_buff *skb) }HARD_TX_UNLOCK (dev, txq);if (net_ratelimit ()) -printk (KERN_CRIT "Virtual device %s asks to " -"queue packet!\n" , dev->name); +pr_crit ("Virtual device %s asks to queue packet!\n" , + dev->name); }else {/* Recursion is detected! It is possible, * unfortunately */ recursion_alert:if (net_ratelimit ()) -printk (KERN_CRIT "Dead loop on virtual device " -"%s, fix it urgently!\n" , dev->name); +pr_crit ("Dead loop on virtual device %s, fix it urgently!\n" , + dev->name); } }
@@ -3069,8 +3065,8 @@ static int ing_filter(struct sk_buff *skb, struct netdev_queue *rxq)if (unlikely (MAX_RED_LOOP < ttl++)) {if (net_ratelimit ()) -pr_warning ("Redir loop detected Dropping packet (%d->%d)\n" , - skb->skb_iif, dev->ifindex); +pr_warn ("Redir loop detected. Dropping packet (%d->%d)\n" , + skb->skb_iif, dev->ifindex);return TC_ACT_SHOT ; }
@@ -4491,16 +4487,16 @@ static int __dev_set_promiscuity(struct net_device *dev, int inc) dev->flags &= ~IFF_PROMISC ; else { dev->promiscuity -= inc; -printk (KERN_WARNING "%s: promiscuity touches roof, " -"set promiscuity failed, promiscuity feature " -"of device might be broken.\n" , dev->name); +pr_warn ("%s: promiscuity touches roof, set promiscuity failed. " +"promiscuity feature of device might be broken.\n" , + dev->name);return -EOVERFLOW ; } }if (dev->flags != old_flags) { -printk (KERN_INFO "device %s %s promiscuous mode\n" , - dev->name, (dev->flags &IFF_PROMISC ) ?"entered" : -"left" ); +pr_info ("device %s %s promiscuous mode\n" , + dev->name, + dev->flags &IFF_PROMISC ?"entered" :"left" );if (audit_enabled) {current_uid_gid (&uid, &gid); audit_log(current->audit_context, GFP_ATOMIC,
@@ -4573,9 +4569,9 @@ int dev_set_allmulti(struct net_device *dev, int inc) dev->flags &= ~IFF_ALLMULTI ; else { dev->allmulti -= inc; -printk (KERN_WARNING "%s: allmulti touches roof, " -"set allmulti failed, allmulti feature of " -"device might be broken.\n" , dev->name); +pr_warn ("%s: allmulti touches roof, set allmulti failed. " +"allmulti feature of device might be broken.\n" , + dev->name);return -EOVERFLOW ; } }
@@ -5232,8 +5228,8 @@ static void rollback_registered_many(struct list_head *head)* devices and proceed with the remaining. */ if (dev->reg_state ==NETREG_UNINITIALIZED ) { -pr_debug ("unregister_netdevice: device %s/%p never " -"was registered\n" , dev->name, dev); +pr_debug ("unregister_netdevice: device %s/%p never was registered\n" , + dev->name, dev);WARN_ON (1 );list_del (&dev->unreg_list);
@@ -5465,7 +5461,7 @@ static int netif_alloc_rx_queues(struct net_device *dev) rx =kcalloc (count,sizeof (struct netdev_rx_queue ),GFP_KERNEL );if (!rx) { -pr_err ("netdev: Unable to allocate %u rx queues.\n" , count); +pr_err ("netdev: Unable to allocate %u rx queues\n" , count);return -ENOMEM ; } dev->_rx = rx;
@@ -5499,8 +5495,7 @@ static int netif_alloc_netdev_queues(struct net_device *dev) tx =kcalloc (count,sizeof (struct netdev_queue ),GFP_KERNEL );if (!tx) { -pr_err ("netdev: Unable to allocate %u tx queues.\n" , - count); +pr_err ("netdev: Unable to allocate %u tx queues\n" , count);return -ENOMEM ; } dev->_tx = tx;
@@ -5759,10 +5754,8 @@ static void netdev_wait_allrefs(struct net_device *dev) refcnt =netdev_refcnt_read (dev);if (time_after (jiffies, warning_time +10 *HZ )) { -printk (KERN_EMERG "unregister_netdevice: " -"waiting for %s to become free. Usage " -"count = %d\n" , - dev->name, refcnt); +pr_emerg ("unregister_netdevice: waiting for %s to become free. Usage count = %d\n" , + dev->name, refcnt); warning_time = jiffies; } }
@@ -5813,7 +5806,7 @@ void netdev_run_todo(void)list_del (&dev->todo_list);if (unlikely (dev->reg_state !=NETREG_UNREGISTERING )) { -printk (KERN_ERR "network todo '%s' but state %d\n" , +pr_err ("network todo '%s' but state %d\n" , dev->name, dev->reg_state);dump_stack ();continue ;
@@ -5929,15 +5922,13 @@ struct net_device *alloc_netdev_mqs(int sizeof_priv, const char *name,BUG_ON (strlen (name) >=sizeof (dev->name));if (txqs <1 ) { -pr_err ("alloc_netdev: Unable to allocate device " -"with zero queues.\n" ); +pr_err ("alloc_netdev: Unable to allocate device with zero queues\n" );return NULL ; }#ifdef CONFIG_RPS if (rxqs <1 ) { -pr_err ("alloc_netdev: Unable to allocate device " -"with zero RX queues.\n" ); +pr_err ("alloc_netdev: Unable to allocate device with zero RX queues\n" );return NULL ; }#endif
@@ -5953,7 +5944,7 @@ struct net_device *alloc_netdev_mqs(int sizeof_priv, const char *name, p =kzalloc (alloc_size,GFP_KERNEL );if (!p) { -printk (KERN_ERR "alloc_netdev: Unable to allocate device.\n" ); +pr_err ("alloc_netdev: Unable to allocate device\n" );return NULL ; }
@@ -6486,8 +6477,8 @@ static void __net_exit default_device_exit(struct net *net)snprintf (fb_name,IFNAMSIZ ,"dev%d" , dev->ifindex); err =dev_change_net_namespace (dev, &init_net, fb_name);if (err) { -printk (KERN_EMERG "%s: failed to move %s to init_net: %d\n" , - __func__, dev->name, err); +pr_emerg ("%s: failed to move %s to init_net: %d\n" , + __func__, dev->name, err);BUG (); } }
Signature · 1 line
1.7.8.111.gad25c.dirty
David Miller
maintainerRe: [PATCH net-next] net: dev: Convert printks to pr_<level>
From: Joe Perches <[email protected]>
Date: Sun, 29 Jan 2012 16:20:30 -0800
net/core/dev.c static void netif_setup_tc(struct net_device *dev, unsigned int txq) · line 1695
Quoted 6 lines
net/core/dev.c +3
-3-pr_warning ("Number of in use tx queues changed " -"invalidating tc mappings. Priority " -"traffic classification disabled!\n" ); +pr_warn ( +"Number of in use tx queues changed invalidating tc mappings. " +"Priority traffic classification disabled!\n" );
Don't do things like this. It is never correct to un-indent subsequent lines of a string like this. And a line ending in "pr_whatever(" looks terrible.
Re: [PATCH net-next] net: dev: Convert printks to pr_<level>
Quoted 11 lines · David Miller
From: Joe Perches <[email protected]>
Date: Sun, 29 Jan 2012 16:20:30 -0800net/core/dev.c static void netif_setup_tc(struct net_device *dev, unsigned int txq) · line 1695
Quoted 6 lines
net/core/dev.c +3
-3-pr_warning ("Number of in use tx queues changed " -"invalidating tc mappings. Priority " -"traffic classification disabled!\n" ); +pr_warn ( +"Number of in use tx queues changed invalidating tc mappings. " +"Priority traffic classification disabled!\n" );Don't do things like this. It is never correct to un-indent subsequent lines of a string like this. And a line ending in "pr_whatever(" looks terrible.
I don't care much one way or another about it. There are a few different uses in that file already.
I do try to avoid having the compiler do string coalescing. In this case, I thought it unlikely that a person would grep with content from both sentences though.
Coalesced, this format is:
"Number of in use tx queues changed invalidating tc mappings. Priority traffic classification disabled!\n"
105 chars. That's pretty long.
Do you prefer coalesced formats in all cases?
pr_warn("Number of in use tx queues changed invalidating tc mappings. Priority traffic classification disabled!\n");David Miller
maintainerRe: [PATCH net-next] net: dev: Convert printks to pr_<level>
From: Joe Perches <[email protected]>
Date: Wed, 01 Feb 2012 11:40:29 -0800
Quoted 3 lines
Do you prefer coalesced formats in all cases?
pr_warn("Number of in use tx queues changed invalidating tc mappings. Priority traffic classification disabled!\n");
It seems to be the new trend, so yes.
PATCH V2 net-next] net: dev: Convert printks to pr_<level>
Use the current logging style.
Coalesce formats where appropriate.
Update grammar where appropriate.
---
V2: Coalesced all formats.
net/core/dev.c | 94 +++++++++++++++++++++++-------------------------------- 1 files changed, 39 insertions(+), 55 deletions(-)
net/core/dev.c +39 -55
@@ -446,7 +446,7 @@ void __dev_remove_pack(struct packet_type *pt) } } -printk (KERN_WARNING "dev_remove_pack: %p not found.\n" , pt); +pr_warn ("dev_remove_pack: %p not found\n" , pt); out:spin_unlock (&ptype_lock); }
@@ -1039,8 +1039,7 @@ rollback:memcpy (dev->name, oldname,IFNAMSIZ ); goto rollback; }else { -printk (KERN_ERR -"%s: name change rollback failed: %d.\n" , +pr_err ("%s: name change rollback failed: %d\n" , dev->name, ret); } }
@@ -1139,9 +1138,8 @@ void dev_load(struct net *net, const char *name) no_module =request_module ("netdev-%s" , name);if (no_module &&capable (CAP_SYS_MODULE )) {if (!request_module ("%s" , name)) -pr_err ("Loading kernel module for a network device " -"with CAP_SYS_MODULE (deprecated). Use CAP_NET_ADMIN and alias netdev-%s " -"instead\n" , name); +pr_err ("Loading kernel module for a network device with CAP_SYS_MODULE (deprecated). Use CAP_NET_ADMIN and alias netdev-%s instead.\n" , + name); } }EXPORT_SYMBOL (dev_load);
@@ -1655,10 +1653,9 @@ static void dev_queue_xmit_nit(struct sk_buff *skb, struct net_device *dev)if (skb_network_header (skb2) < skb2->data || skb2->network_header > skb2->tail) {if (net_ratelimit ()) -printk (KERN_CRIT "protocol %04x is " -"buggy, dev %s\n" , -ntohs (skb2->protocol), - dev->name); +pr_crit ("protocol %04x is buggy, dev %s\n" , +ntohs (skb2->protocol), + dev->name);skb_reset_network_header (skb2); }
@@ -1691,9 +1688,7 @@ static void netif_setup_tc(struct net_device *dev, unsigned int txq)/* If TC0 is invalidated disable TC mapping */ if (tc->offset + tc->count > txq) { -pr_warning ("Number of in use tx queues changed " -"invalidating tc mappings. Priority " -"traffic classification disabled!\n" ); +pr_warn ("Number of in use tx queues changed invalidating tc mappings. Priority traffic classification disabled!\n" ); dev->num_tc =0 ;return ; }
@@ -1704,11 +1699,8 @@ static void netif_setup_tc(struct net_device *dev, unsigned int txq) tc = &dev->tc_to_txq[q];if (tc->offset + tc->count > txq) { -pr_warning ("Number of in use tx queues " -"changed. Priority %i to tc " -"mapping %i is no longer valid " -"setting map to 0\n" , - i, q); +pr_warn ("Number of in use tx queues changed. Priority %i to tc mapping %i is no longer valid. Setting map to 0\n" , + i, q);netdev_set_prio_tc_map (dev, i,0 ); } }
@@ -2014,8 +2006,7 @@ EXPORT_SYMBOL(skb_gso_segment);void netdev_rx_csum_fault (struct net_device *dev) {if (net_ratelimit ()) { -printk (KERN_ERR "%s: hw csum failure.\n" , - dev ? dev->name :"<unknown>" ); +pr_err ("%s: hw csum failure\n" , dev ? dev->name :"<unknown>" );dump_stack (); } }
@@ -2332,9 +2323,9 @@ static inline u16 dev_cap_txqueue(struct net_device *dev, u16 queue_index) {if (unlikely (queue_index >= dev->real_num_tx_queues)) {if (net_ratelimit ()) { -pr_warning ("%s selects TX queue %d, but " -"real number of TX queues is %d\n" , - dev->name, queue_index, dev->real_num_tx_queues); +pr_warn ("%s selects TX queue %d, but real number of TX queues is %d\n" , + dev->name, queue_index, + dev->real_num_tx_queues); }return 0 ; }
@@ -2578,16 +2569,16 @@ int dev_queue_xmit(struct sk_buff *skb) }HARD_TX_UNLOCK (dev, txq);if (net_ratelimit ()) -printk (KERN_CRIT "Virtual device %s asks to " -"queue packet!\n" , dev->name); +pr_crit ("Virtual device %s asks to queue packet!\n" , + dev->name); }else {/* Recursion is detected! It is possible, * unfortunately */ recursion_alert:if (net_ratelimit ()) -printk (KERN_CRIT "Dead loop on virtual device " -"%s, fix it urgently!\n" , dev->name); +pr_crit ("Dead loop on virtual device %s, fix it urgently!\n" , + dev->name); } }
@@ -3069,8 +3060,8 @@ static int ing_filter(struct sk_buff *skb, struct netdev_queue *rxq)if (unlikely (MAX_RED_LOOP < ttl++)) {if (net_ratelimit ()) -pr_warning ("Redir loop detected Dropping packet (%d->%d)\n" , - skb->skb_iif, dev->ifindex); +pr_warn ("Redir loop detected Dropping packet (%d->%d)\n" , + skb->skb_iif, dev->ifindex);return TC_ACT_SHOT ; }
@@ -4491,16 +4482,15 @@ static int __dev_set_promiscuity(struct net_device *dev, int inc) dev->flags &= ~IFF_PROMISC ; else { dev->promiscuity -= inc; -printk (KERN_WARNING "%s: promiscuity touches roof, " -"set promiscuity failed, promiscuity feature " -"of device might be broken.\n" , dev->name); +pr_warn ("%s: promiscuity touches roof, set promiscuity failed. promiscuity feature of device might be broken.\n" , + dev->name);return -EOVERFLOW ; } }if (dev->flags != old_flags) { -printk (KERN_INFO "device %s %s promiscuous mode\n" , - dev->name, (dev->flags &IFF_PROMISC ) ?"entered" : -"left" ); +pr_info ("device %s %s promiscuous mode\n" , + dev->name, + dev->flags &IFF_PROMISC ?"entered" :"left" );if (audit_enabled) {current_uid_gid (&uid, &gid); audit_log(current->audit_context, GFP_ATOMIC,
@@ -4573,9 +4563,8 @@ int dev_set_allmulti(struct net_device *dev, int inc) dev->flags &= ~IFF_ALLMULTI ; else { dev->allmulti -= inc; -printk (KERN_WARNING "%s: allmulti touches roof, " -"set allmulti failed, allmulti feature of " -"device might be broken.\n" , dev->name); +pr_warn ("%s: allmulti touches roof, set allmulti failed. allmulti feature of device might be broken.\n" , + dev->name);return -EOVERFLOW ; } }
@@ -5232,8 +5221,8 @@ static void rollback_registered_many(struct list_head *head)* devices and proceed with the remaining. */ if (dev->reg_state ==NETREG_UNINITIALIZED ) { -pr_debug ("unregister_netdevice: device %s/%p never " -"was registered\n" , dev->name, dev); +pr_debug ("unregister_netdevice: device %s/%p never was registered\n" , + dev->name, dev);WARN_ON (1 );list_del (&dev->unreg_list);
@@ -5465,7 +5454,7 @@ static int netif_alloc_rx_queues(struct net_device *dev) rx =kcalloc (count,sizeof (struct netdev_rx_queue ),GFP_KERNEL );if (!rx) { -pr_err ("netdev: Unable to allocate %u rx queues.\n" , count); +pr_err ("netdev: Unable to allocate %u rx queues\n" , count);return -ENOMEM ; } dev->_rx = rx;
@@ -5499,8 +5488,7 @@ static int netif_alloc_netdev_queues(struct net_device *dev) tx =kcalloc (count,sizeof (struct netdev_queue ),GFP_KERNEL );if (!tx) { -pr_err ("netdev: Unable to allocate %u tx queues.\n" , - count); +pr_err ("netdev: Unable to allocate %u tx queues\n" , count);return -ENOMEM ; } dev->_tx = tx;
@@ -5759,10 +5747,8 @@ static void netdev_wait_allrefs(struct net_device *dev) refcnt =netdev_refcnt_read (dev);if (time_after (jiffies, warning_time +10 *HZ )) { -printk (KERN_EMERG "unregister_netdevice: " -"waiting for %s to become free. Usage " -"count = %d\n" , - dev->name, refcnt); +pr_emerg ("unregister_netdevice: waiting for %s to become free. Usage count = %d\n" , + dev->name, refcnt); warning_time = jiffies; } }
@@ -5813,7 +5799,7 @@ void netdev_run_todo(void)list_del (&dev->todo_list);if (unlikely (dev->reg_state !=NETREG_UNREGISTERING )) { -printk (KERN_ERR "network todo '%s' but state %d\n" , +pr_err ("network todo '%s' but state %d\n" , dev->name, dev->reg_state);dump_stack ();continue ;
@@ -5929,15 +5915,13 @@ struct net_device *alloc_netdev_mqs(int sizeof_priv, const char *name,BUG_ON (strlen (name) >=sizeof (dev->name));if (txqs <1 ) { -pr_err ("alloc_netdev: Unable to allocate device " -"with zero queues.\n" ); +pr_err ("alloc_netdev: Unable to allocate device with zero queues\n" );return NULL ; }#ifdef CONFIG_RPS if (rxqs <1 ) { -pr_err ("alloc_netdev: Unable to allocate device " -"with zero RX queues.\n" ); +pr_err ("alloc_netdev: Unable to allocate device with zero RX queues\n" );return NULL ; }#endif
@@ -5953,7 +5937,7 @@ struct net_device *alloc_netdev_mqs(int sizeof_priv, const char *name, p =kzalloc (alloc_size,GFP_KERNEL );if (!p) { -printk (KERN_ERR "alloc_netdev: Unable to allocate device.\n" ); +pr_err ("alloc_netdev: Unable to allocate device\n" );return NULL ; }
@@ -6486,8 +6470,8 @@ static void __net_exit default_device_exit(struct net *net)snprintf (fb_name,IFNAMSIZ ,"dev%d" , dev->ifindex); err =dev_change_net_namespace (dev, &init_net, fb_name);if (err) { -printk (KERN_EMERG "%s: failed to move %s to init_net: %d\n" , - __func__, dev->name, err); +pr_emerg ("%s: failed to move %s to init_net: %d\n" , + __func__, dev->name, err);BUG (); } }
Re: PATCH V2 net-next] net: dev: Convert printks to pr_<level>
From: Joe Perches <[email protected]>
Date: Wed, 01 Feb 2012 12:54:43 -0800
Quoted 5 lines
Use the current logging style.
Coalesce formats where appropriate.
Update grammar where appropriate.Signed-off-by Joe Perches <[email protected]>
Applied, thanks.
Re: [PATCH net-next] drivers/net: Remove alloc_etherdev error messages
In reply to Joe PerchesFrom: Joe Perches <[email protected]>
Date: Sun, 29 Jan 2012 15:47:52 -0800
Quoted 4 lines
alloc_etherdevhas a generic OOM/unable to alloc message. Remove the duplicative messages afteralloc_etherdevcalls.Signed-off-by Joe Perches <[email protected]>
Applied.
From: Joe Perches <[email protected]>
Date: Sun, 29 Jan 2012 14:56:23 -0800
Quoted 6 lines
alloc failures use
dump_stackso emitting an additional out-of-memory message is an unnecessary duplication.Remove the allocation failure messages.
Signed-off-by Joe Perches <[email protected]>
Applied.