Commit 623d896b authored by Julia Lawall's avatar Julia Lawall Committed by David S. Miller

drivers/net/wan/dscc4.c: fix error return code

Move up the initialization of rc so that failure of pci_alloc_consistent
returns -ENOMEM as well.

A simplified version of the semantic match that finds this problem is as
follows: (http://coccinelle.lip6.fr/)

// <smpl>
@@
identifier ret;
expression e1,e2;
@@

if (ret < 0)
 { ... return ret; }
 ... when != ret = e1
     when forall
*if(...)
 {
  ... when != ret = e2
* return ret;
 }
// </smpl>
Signed-off-by: default avatarJulia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 82a820e8
...@@ -774,14 +774,15 @@ static int __devinit dscc4_init_one(struct pci_dev *pdev, ...@@ -774,14 +774,15 @@ static int __devinit dscc4_init_one(struct pci_dev *pdev,
} }
/* Global interrupt queue */ /* Global interrupt queue */
writel((u32)(((IRQ_RING_SIZE >> 5) - 1) << 20), ioaddr + IQLENR1); writel((u32)(((IRQ_RING_SIZE >> 5) - 1) << 20), ioaddr + IQLENR1);
rc = -ENOMEM;
priv->iqcfg = (__le32 *) pci_alloc_consistent(pdev, priv->iqcfg = (__le32 *) pci_alloc_consistent(pdev,
IRQ_RING_SIZE*sizeof(__le32), &priv->iqcfg_dma); IRQ_RING_SIZE*sizeof(__le32), &priv->iqcfg_dma);
if (!priv->iqcfg) if (!priv->iqcfg)
goto err_free_irq_5; goto err_free_irq_5;
writel(priv->iqcfg_dma, ioaddr + IQCFG); writel(priv->iqcfg_dma, ioaddr + IQCFG);
rc = -ENOMEM;
/* /*
* SCC 0-3 private rx/tx irq structures * SCC 0-3 private rx/tx irq structures
* IQRX/TXi needs to be set soon. Learned it the hard way... * IQRX/TXi needs to be set soon. Learned it the hard way...
......
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