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.

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Joe Perches 2012-01-29 13:47:52 +00:00 committed by David S. Miller
parent e404decb0f
commit 41de8d4cff
86 changed files with 63 additions and 192 deletions

View File

@ -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);

View File

@ -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;

View File

@ -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);

View File

@ -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);

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -1269,10 +1269,8 @@ static int __devinit bmac_probe(struct macio_dev *mdev, const struct of_device_i
memcpy(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);

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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);

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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);

View File

@ -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;

View File

@ -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);

View File

@ -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);

View File

@ -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) {

View File

@ -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 */

View File

@ -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;

View File

@ -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;
}

View File

@ -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]);

View File

@ -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;
}

View File

@ -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;

View File

@ -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);

View File

@ -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;
}

View File

@ -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);

View File

@ -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;
}

View File

@ -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);

View File

@ -731,6 +731,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 = &ltq_eth_netdev_ops;
dev->ethtool_ops = &ltq_etop_ethtool_ops;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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);

View File

@ -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;

View File

@ -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;
}

View File

@ -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);

View File

@ -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;

View File

@ -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;
}

View File

@ -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);

View File

@ -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);

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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);

View File

@ -4008,8 +4008,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;
}

View File

@ -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;
}

View File

@ -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;

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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);

View File

@ -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);

View File

@ -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;
}

View File

@ -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);

View File

@ -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;
}

View File

@ -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;

View File

@ -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;
}

View File

@ -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);

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;

View File

@ -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);

View File

@ -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);

View File

@ -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 */

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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;
}

View File

@ -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;

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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;

View File

@ -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;

View File

@ -1279,11 +1279,8 @@ static struct net_device * __devinit xennet_create_dev(struct xenbus_device *dev
struct 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;