summaryrefslogtreecommitdiffstats
path: root/drivers/uio
diff options
context:
space:
mode:
authorKulikov Vasiliy <segooon@gmail.com>2010-08-03 19:44:23 +0400
committerGreg Kroah-Hartman <gregkh@suse.de>2010-10-22 10:16:42 -0700
commit1037246cacd45d951227c8798f181b3ba5c8bcbe (patch)
treedbf5580c239ddd84ec4bd6c8479a60d55a62f5d9 /drivers/uio
parentd79d32440c33cf60f1e0efbeb8144b1647be0b50 (diff)
downloadlinux-stable-1037246cacd45d951227c8798f181b3ba5c8bcbe.tar.gz
linux-stable-1037246cacd45d951227c8798f181b3ba5c8bcbe.tar.bz2
linux-stable-1037246cacd45d951227c8798f181b3ba5c8bcbe.zip
uio: do not use PCI resources before pci_enable_device()
IRQ and resource[] may not have correct values until after PCI hotplug setup occurs at pci_enable_device() time. The semantic match that finds this problem is as follows: // <smpl> @@ identifier x; identifier request ~= "pci_request.*|pci_resource.*"; @@ ( * x->irq | * x->resource | * request(x, ...) ) ... *pci_enable_device(x) // </smpl> Signed-off-by: Kulikov Vasiliy <segooon@gmail.com> Acked-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Hans J. Koch <hjk@linutronix.de> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/uio')
-rw-r--r--drivers/uio/uio_pci_generic.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/drivers/uio/uio_pci_generic.c b/drivers/uio/uio_pci_generic.c
index 85c9884a67fd..fc22e1e6f215 100644
--- a/drivers/uio/uio_pci_generic.c
+++ b/drivers/uio/uio_pci_generic.c
@@ -128,12 +128,6 @@ static int __devinit probe(struct pci_dev *pdev,
struct uio_pci_generic_dev *gdev;
int err;
- if (!pdev->irq) {
- dev_warn(&pdev->dev, "No IRQ assigned to device: "
- "no support for interrupts?\n");
- return -ENODEV;
- }
-
err = pci_enable_device(pdev);
if (err) {
dev_err(&pdev->dev, "%s: pci_enable_device failed: %d\n",
@@ -141,6 +135,13 @@ static int __devinit probe(struct pci_dev *pdev,
return err;
}
+ if (!pdev->irq) {
+ dev_warn(&pdev->dev, "No IRQ assigned to device: "
+ "no support for interrupts?\n");
+ pci_disable_device(pdev);
+ return -ENODEV;
+ }
+
err = verify_pci_2_3(pdev);
if (err)
goto err_verify;