Commit cb001a1f authored by Joe Perches's avatar Joe Perches Committed by David S. Miller

drivers/net/tehuti.c: Hoist assigns out of ifs

Signed-off-by: default avatarJoe Perches <joe@perches.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 865a21a5
...@@ -420,8 +420,10 @@ static int bdx_hw_start(struct bdx_priv *priv) ...@@ -420,8 +420,10 @@ static int bdx_hw_start(struct bdx_priv *priv)
GMAC_RX_FILTER_AM | GMAC_RX_FILTER_AB); GMAC_RX_FILTER_AM | GMAC_RX_FILTER_AB);
#define BDX_IRQ_TYPE ((priv->nic->irq_type == IRQ_MSI)?0:IRQF_SHARED) #define BDX_IRQ_TYPE ((priv->nic->irq_type == IRQ_MSI)?0:IRQF_SHARED)
if ((rc = request_irq(priv->pdev->irq, bdx_isr_napi, BDX_IRQ_TYPE,
ndev->name, ndev))) rc = request_irq(priv->pdev->irq, bdx_isr_napi, BDX_IRQ_TYPE,
ndev->name, ndev);
if (rc)
goto err_irq; goto err_irq;
bdx_enable_interrupts(priv); bdx_enable_interrupts(priv);
...@@ -603,18 +605,15 @@ static int bdx_open(struct net_device *ndev) ...@@ -603,18 +605,15 @@ static int bdx_open(struct net_device *ndev)
if (netif_running(ndev)) if (netif_running(ndev))
netif_stop_queue(priv->ndev); netif_stop_queue(priv->ndev);
if ((rc = bdx_tx_init(priv))) if ((rc = bdx_tx_init(priv)) ||
goto err; (rc = bdx_rx_init(priv)) ||
(rc = bdx_fw_load(priv)))
if ((rc = bdx_rx_init(priv)))
goto err;
if ((rc = bdx_fw_load(priv)))
goto err; goto err;
bdx_rx_alloc_skbs(priv, &priv->rxf_fifo0); bdx_rx_alloc_skbs(priv, &priv->rxf_fifo0);
if ((rc = bdx_hw_start(priv))) rc = bdx_hw_start(priv);
if (rc)
goto err; goto err;
napi_enable(&priv->napi); napi_enable(&priv->napi);
...@@ -1027,10 +1026,9 @@ static int bdx_rx_init(struct bdx_priv *priv) ...@@ -1027,10 +1026,9 @@ static int bdx_rx_init(struct bdx_priv *priv)
regRXF_CFG0_0, regRXF_CFG1_0, regRXF_CFG0_0, regRXF_CFG1_0,
regRXF_RPTR_0, regRXF_WPTR_0)) regRXF_RPTR_0, regRXF_WPTR_0))
goto err_mem; goto err_mem;
if (! priv->rxdb = bdx_rxdb_create(priv->rxf_fifo0.m.memsz /
(priv->rxdb = sizeof(struct rxf_desc));
bdx_rxdb_create(priv->rxf_fifo0.m.memsz / if (!priv->rxdb)
sizeof(struct rxf_desc))))
goto err_mem; goto err_mem;
priv->rxf_fifo0.m.pktsz = priv->ndev->mtu + VLAN_ETH_HLEN; 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,7 +1112,8 @@ static void bdx_rx_alloc_skbs(struct bdx_priv *priv, struct rxf_fifo *f)
ENTER; ENTER;
dno = bdx_rxdb_available(db) - 1; dno = bdx_rxdb_available(db) - 1;
while (dno > 0) { while (dno > 0) {
if (!(skb = dev_alloc_skb(f->m.pktsz + NET_IP_ALIGN))) { skb = dev_alloc_skb(f->m.pktsz + NET_IP_ALIGN);
if (!skb) {
pr_err("NO MEM: dev_alloc_skb failed\n"); pr_err("NO MEM: dev_alloc_skb failed\n");
break; break;
} }
...@@ -1934,8 +1933,9 @@ bdx_probe(struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -1934,8 +1933,9 @@ bdx_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
RET(-ENOMEM); RET(-ENOMEM);
/************** pci *****************/ /************** pci *****************/
if ((err = pci_enable_device(pdev))) /* it trigers interrupt, dunno why. */ err = pci_enable_device(pdev);
goto err_pci; /* it's not a problem though */ if (err) /* it triggers interrupt, dunno why. */
goto err_pci; /* it's not a problem though */
if (!(err = pci_set_dma_mask(pdev, DMA_BIT_MASK(64))) && if (!(err = pci_set_dma_mask(pdev, DMA_BIT_MASK(64))) &&
!(err = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(64)))) { !(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,7 +1949,8 @@ bdx_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
pci_using_dac = 0; pci_using_dac = 0;
} }
if ((err = pci_request_regions(pdev, BDX_DRV_NAME))) err = pci_request_regions(pdev, BDX_DRV_NAME);
if (err)
goto err_dma; goto err_dma;
pci_set_master(pdev); pci_set_master(pdev);
...@@ -1960,7 +1961,8 @@ bdx_probe(struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -1960,7 +1961,8 @@ bdx_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
pr_err("no MMIO resource\n"); pr_err("no MMIO resource\n");
goto err_out_res; goto err_out_res;
} }
if ((regionSize = pci_resource_len(pdev, 0)) < BDX_REGS_SIZE) { regionSize = pci_resource_len(pdev, 0);
if (regionSize < BDX_REGS_SIZE) {
err = -EIO; err = -EIO;
pr_err("MMIO resource (%x) too small\n", regionSize); pr_err("MMIO resource (%x) too small\n", regionSize);
goto err_out_res; goto err_out_res;
...@@ -1992,7 +1994,8 @@ bdx_probe(struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -1992,7 +1994,8 @@ bdx_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
nic->irq_type = IRQ_INTX; nic->irq_type = IRQ_INTX;
#ifdef BDX_MSI #ifdef BDX_MSI
if ((readl(nic->regs + FPGA_VER) & 0xFFF) >= 378) { if ((readl(nic->regs + FPGA_VER) & 0xFFF) >= 378) {
if ((err = pci_enable_msi(pdev))) err = pci_enable_msi(pdev);
if (err)
pr_err("Can't eneble msi. error is %d\n", err); pr_err("Can't eneble msi. error is %d\n", err);
else else
nic->irq_type = IRQ_MSI; nic->irq_type = IRQ_MSI;
...@@ -2002,7 +2005,8 @@ bdx_probe(struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -2002,7 +2005,8 @@ bdx_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
/************** netdev **************/ /************** netdev **************/
for (port = 0; port < nic->port_num; port++) { for (port = 0; port < nic->port_num; port++) {
if (!(ndev = alloc_etherdev(sizeof(struct bdx_priv)))) { ndev = alloc_etherdev(sizeof(struct bdx_priv));
if (!ndev) {
err = -ENOMEM; err = -ENOMEM;
pr_err("alloc_etherdev failed\n"); pr_err("alloc_etherdev failed\n");
goto err_out_iomap; goto err_out_iomap;
...@@ -2075,7 +2079,8 @@ bdx_probe(struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -2075,7 +2079,8 @@ bdx_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
goto err_out_iomap; goto err_out_iomap;
} }
SET_NETDEV_DEV(ndev, &pdev->dev); SET_NETDEV_DEV(ndev, &pdev->dev);
if ((err = register_netdev(ndev))) { err = register_netdev(ndev);
if (err) {
pr_err("register_netdev failed\n"); pr_err("register_netdev failed\n");
goto err_out_free; goto err_out_free;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment