aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/tehuti.c
diff options
context:
space:
mode:
authorJoe Perches <joe@perches.com>2010-02-15 03:34:23 -0500
committerDavid S. Miller <davem@davemloft.net>2010-02-16 18:45:43 -0500
commitcb001a1f7db6ffb0fff0796c60853c2bf2e512c3 (patch)
tree2cbaff89bd192d3f78812fdb29d05db079449c0e /drivers/net/tehuti.c
parent865a21a5e3d1b384c559a44c898fcad93e187b82 (diff)
drivers/net/tehuti.c: Hoist assigns out of ifs
Signed-off-by: Joe Perches <joe@perches.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/tehuti.c')
-rw-r--r--drivers/net/tehuti.c49
1 files changed, 27 insertions, 22 deletions
diff --git a/drivers/net/tehuti.c b/drivers/net/tehuti.c
index 82e522a114d2..fdf87ea7bc4e 100644
--- a/drivers/net/tehuti.c
+++ b/drivers/net/tehuti.c
@@ -420,8 +420,10 @@ static int bdx_hw_start(struct bdx_priv *priv)
420 GMAC_RX_FILTER_AM | GMAC_RX_FILTER_AB); 420 GMAC_RX_FILTER_AM | GMAC_RX_FILTER_AB);
421 421
422#define BDX_IRQ_TYPE ((priv->nic->irq_type == IRQ_MSI)?0:IRQF_SHARED) 422#define BDX_IRQ_TYPE ((priv->nic->irq_type == IRQ_MSI)?0:IRQF_SHARED)
423 if ((rc = request_irq(priv->pdev->irq, bdx_isr_napi, BDX_IRQ_TYPE, 423
424 ndev->name, ndev))) 424 rc = request_irq(priv->pdev->irq, bdx_isr_napi, BDX_IRQ_TYPE,
425 ndev->name, ndev);
426 if (rc)
425 goto err_irq; 427 goto err_irq;
426 bdx_enable_interrupts(priv); 428 bdx_enable_interrupts(priv);
427 429
@@ -603,18 +605,15 @@ static int bdx_open(struct net_device *ndev)
603 if (netif_running(ndev)) 605 if (netif_running(ndev))
604 netif_stop_queue(priv->ndev); 606 netif_stop_queue(priv->ndev);
605 607
606 if ((rc = bdx_tx_init(priv))) 608 if ((rc = bdx_tx_init(priv)) ||
607 goto err; 609 (rc = bdx_rx_init(priv)) ||
608 610 (rc = bdx_fw_load(priv)))
609 if ((rc = bdx_rx_init(priv)))
610 goto err;
611
612 if ((rc = bdx_fw_load(priv)))
613 goto err; 611 goto err;
614 612
615 bdx_rx_alloc_skbs(priv, &priv->rxf_fifo0); 613 bdx_rx_alloc_skbs(priv, &priv->rxf_fifo0);
616 614
617 if ((rc = bdx_hw_start(priv))) 615 rc = bdx_hw_start(priv);
616 if (rc)
618 goto err; 617 goto err;
619 618
620 napi_enable(&priv->napi); 619 napi_enable(&priv->napi);
@@ -1027,10 +1026,9 @@ static int bdx_rx_init(struct bdx_priv *priv)
1027 regRXF_CFG0_0, regRXF_CFG1_0, 1026 regRXF_CFG0_0, regRXF_CFG1_0,
1028 regRXF_RPTR_0, regRXF_WPTR_0)) 1027 regRXF_RPTR_0, regRXF_WPTR_0))
1029 goto err_mem; 1028 goto err_mem;
1030 if (! 1029 priv->rxdb = bdx_rxdb_create(priv->rxf_fifo0.m.memsz /
1031 (priv->rxdb = 1030 sizeof(struct rxf_desc));
1032 bdx_rxdb_create(priv->rxf_fifo0.m.memsz / 1031 if (!priv->rxdb)
1033 sizeof(struct rxf_desc))))
1034 goto err_mem; 1032 goto err_mem;
1035 1033
1036 priv->rxf_fifo0.m.pktsz = priv->ndev->mtu + VLAN_ETH_HLEN; 1034 priv->rxf_fifo0.m.pktsz = priv->ndev->mtu + VLAN_ETH_HLEN;
@@ -1114,7 +1112,8 @@ static void bdx_rx_alloc_skbs(struct bdx_priv *priv, struct rxf_fifo *f)
1114 ENTER; 1112 ENTER;
1115 dno = bdx_rxdb_available(db) - 1; 1113 dno = bdx_rxdb_available(db) - 1;
1116 while (dno > 0) { 1114 while (dno > 0) {
1117 if (!(skb = dev_alloc_skb(f->m.pktsz + NET_IP_ALIGN))) { 1115 skb = dev_alloc_skb(f->m.pktsz + NET_IP_ALIGN);
1116 if (!skb) {
1118 pr_err("NO MEM: dev_alloc_skb failed\n"); 1117 pr_err("NO MEM: dev_alloc_skb failed\n");
1119 break; 1118 break;
1120 } 1119 }
@@ -1934,8 +1933,9 @@ bdx_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
1934 RET(-ENOMEM); 1933 RET(-ENOMEM);
1935 1934
1936 /************** pci *****************/ 1935 /************** pci *****************/
1937 if ((err = pci_enable_device(pdev))) /* it trigers interrupt, dunno why. */ 1936 err = pci_enable_device(pdev);
1938 goto err_pci; /* it's not a problem though */ 1937 if (err) /* it triggers interrupt, dunno why. */
1938 goto err_pci; /* it's not a problem though */
1939 1939
1940 if (!(err = pci_set_dma_mask(pdev, DMA_BIT_MASK(64))) && 1940 if (!(err = pci_set_dma_mask(pdev, DMA_BIT_MASK(64))) &&
1941 !(err = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(64)))) { 1941 !(err = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(64)))) {
@@ -1949,7 +1949,8 @@ bdx_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
1949 pci_using_dac = 0; 1949 pci_using_dac = 0;
1950 } 1950 }
1951 1951
1952 if ((err = pci_request_regions(pdev, BDX_DRV_NAME))) 1952 err = pci_request_regions(pdev, BDX_DRV_NAME);
1953 if (err)
1953 goto err_dma; 1954 goto err_dma;
1954 1955
1955 pci_set_master(pdev); 1956 pci_set_master(pdev);
@@ -1960,7 +1961,8 @@ bdx_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
1960 pr_err("no MMIO resource\n"); 1961 pr_err("no MMIO resource\n");
1961 goto err_out_res; 1962 goto err_out_res;
1962 } 1963 }
1963 if ((regionSize = pci_resource_len(pdev, 0)) < BDX_REGS_SIZE) { 1964 regionSize = pci_resource_len(pdev, 0);
1965 if (regionSize < BDX_REGS_SIZE) {
1964 err = -EIO; 1966 err = -EIO;
1965 pr_err("MMIO resource (%x) too small\n", regionSize); 1967 pr_err("MMIO resource (%x) too small\n", regionSize);
1966 goto err_out_res; 1968 goto err_out_res;
@@ -1992,7 +1994,8 @@ bdx_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
1992 nic->irq_type = IRQ_INTX; 1994 nic->irq_type = IRQ_INTX;
1993#ifdef BDX_MSI 1995#ifdef BDX_MSI
1994 if ((readl(nic->regs + FPGA_VER) & 0xFFF) >= 378) { 1996 if ((readl(nic->regs + FPGA_VER) & 0xFFF) >= 378) {
1995 if ((err = pci_enable_msi(pdev))) 1997 err = pci_enable_msi(pdev);
1998 if (err)
1996 pr_err("Can't eneble msi. error is %d\n", err); 1999 pr_err("Can't eneble msi. error is %d\n", err);
1997 else 2000 else
1998 nic->irq_type = IRQ_MSI; 2001 nic->irq_type = IRQ_MSI;
@@ -2002,7 +2005,8 @@ bdx_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
2002 2005
2003 /************** netdev **************/ 2006 /************** netdev **************/
2004 for (port = 0; port < nic->port_num; port++) { 2007 for (port = 0; port < nic->port_num; port++) {
2005 if (!(ndev = alloc_etherdev(sizeof(struct bdx_priv)))) { 2008 ndev = alloc_etherdev(sizeof(struct bdx_priv));
2009 if (!ndev) {
2006 err = -ENOMEM; 2010 err = -ENOMEM;
2007 pr_err("alloc_etherdev failed\n"); 2011 pr_err("alloc_etherdev failed\n");
2008 goto err_out_iomap; 2012 goto err_out_iomap;
@@ -2075,7 +2079,8 @@ bdx_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
2075 goto err_out_iomap; 2079 goto err_out_iomap;
2076 } 2080 }
2077 SET_NETDEV_DEV(ndev, &pdev->dev); 2081 SET_NETDEV_DEV(ndev, &pdev->dev);
2078 if ((err = register_netdev(ndev))) { 2082 err = register_netdev(ndev);
2083 if (err) {
2079 pr_err("register_netdev failed\n"); 2084 pr_err("register_netdev failed\n");
2080 goto err_out_free; 2085 goto err_out_free;
2081 } 2086 }