Commit 87786945 authored by Meelis Roos's avatar Meelis Roos Committed by David S. Miller

tmspci: fix request_irq race

Currently, tmspci tokenring driver crashes on device initialization
because it requests its irq before initializing corresponding data
structures. Fix this by moving request_irq call to a safer place.
Signed-off-by: default avatarMeelis Roos <mroos@linux.ee>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent a883bf56
...@@ -121,11 +121,6 @@ static int __devinit tms_pci_attach(struct pci_dev *pdev, const struct pci_devic ...@@ -121,11 +121,6 @@ static int __devinit tms_pci_attach(struct pci_dev *pdev, const struct pci_devic
goto err_out_trdev; goto err_out_trdev;
} }
ret = request_irq(pdev->irq, tms380tr_interrupt, IRQF_SHARED,
dev->name, dev);
if (ret)
goto err_out_region;
dev->base_addr = pci_ioaddr; dev->base_addr = pci_ioaddr;
dev->irq = pci_irq_line; dev->irq = pci_irq_line;
dev->dma = 0; dev->dma = 0;
...@@ -142,7 +137,7 @@ static int __devinit tms_pci_attach(struct pci_dev *pdev, const struct pci_devic ...@@ -142,7 +137,7 @@ static int __devinit tms_pci_attach(struct pci_dev *pdev, const struct pci_devic
ret = tmsdev_init(dev, &pdev->dev); ret = tmsdev_init(dev, &pdev->dev);
if (ret) { if (ret) {
printk("%s: unable to get memory for dev->priv.\n", dev->name); printk("%s: unable to get memory for dev->priv.\n", dev->name);
goto err_out_irq; goto err_out_region;
} }
tp = netdev_priv(dev); tp = netdev_priv(dev);
...@@ -157,6 +152,11 @@ static int __devinit tms_pci_attach(struct pci_dev *pdev, const struct pci_devic ...@@ -157,6 +152,11 @@ static int __devinit tms_pci_attach(struct pci_dev *pdev, const struct pci_devic
tp->tmspriv = cardinfo; tp->tmspriv = cardinfo;
ret = request_irq(pdev->irq, tms380tr_interrupt, IRQF_SHARED,
dev->name, dev);
if (ret)
goto err_out_tmsdev;
dev->open = tms380tr_open; dev->open = tms380tr_open;
dev->stop = tms380tr_close; dev->stop = tms380tr_close;
pci_set_drvdata(pdev, dev); pci_set_drvdata(pdev, dev);
...@@ -164,15 +164,15 @@ static int __devinit tms_pci_attach(struct pci_dev *pdev, const struct pci_devic ...@@ -164,15 +164,15 @@ static int __devinit tms_pci_attach(struct pci_dev *pdev, const struct pci_devic
ret = register_netdev(dev); ret = register_netdev(dev);
if (ret) if (ret)
goto err_out_tmsdev; goto err_out_irq;
return 0; return 0;
err_out_irq:
free_irq(pdev->irq, dev);
err_out_tmsdev: err_out_tmsdev:
pci_set_drvdata(pdev, NULL); pci_set_drvdata(pdev, NULL);
tmsdev_term(dev); tmsdev_term(dev);
err_out_irq:
free_irq(pdev->irq, dev);
err_out_region: err_out_region:
release_region(pci_ioaddr, TMS_PCI_IO_EXTENT); release_region(pci_ioaddr, TMS_PCI_IO_EXTENT);
err_out_trdev: err_out_trdev:
......
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