Commit 5629236b authored by Kulikov Vasiliy's avatar Kulikov Vasiliy Committed by Matthew Garrett

x86: intel_ips: 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: default avatarKulikov Vasiliy <segooon@gmail.com>
Reviewed-by: default avatarJesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: default avatarMatthew Garrett <mjg@redhat.com>
parent da5cabf8
...@@ -1432,6 +1432,12 @@ static int ips_probe(struct pci_dev *dev, const struct pci_device_id *id) ...@@ -1432,6 +1432,12 @@ static int ips_probe(struct pci_dev *dev, const struct pci_device_id *id)
spin_lock_init(&ips->turbo_status_lock); spin_lock_init(&ips->turbo_status_lock);
ret = pci_enable_device(dev);
if (ret) {
dev_err(&dev->dev, "can't enable PCI device, aborting\n");
goto error_free;
}
if (!pci_resource_start(dev, 0)) { if (!pci_resource_start(dev, 0)) {
dev_err(&dev->dev, "TBAR not assigned, aborting\n"); dev_err(&dev->dev, "TBAR not assigned, aborting\n");
ret = -ENXIO; ret = -ENXIO;
...@@ -1444,11 +1450,6 @@ static int ips_probe(struct pci_dev *dev, const struct pci_device_id *id) ...@@ -1444,11 +1450,6 @@ static int ips_probe(struct pci_dev *dev, const struct pci_device_id *id)
goto error_free; goto error_free;
} }
ret = pci_enable_device(dev);
if (ret) {
dev_err(&dev->dev, "can't enable PCI device, aborting\n");
goto error_free;
}
ips->regmap = ioremap(pci_resource_start(dev, 0), ips->regmap = ioremap(pci_resource_start(dev, 0),
pci_resource_len(dev, 0)); pci_resource_len(dev, 0));
......
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