Skip to content

Commit 46cfc58

Browse files
segoonairlied
authored andcommitted
agp: efficeon-agp: 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 <[email protected]> Signed-off-by: Dave Airlie <[email protected]>
1 parent 5837471 commit 46cfc58

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

drivers/char/agp/efficeon-agp.c

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -371,6 +371,17 @@ static int __devinit agp_efficeon_probe(struct pci_dev *pdev,
371371
bridge->dev = pdev;
372372
bridge->capndx = cap_ptr;
373373

374+
/*
375+
* If the device has not been properly setup, the following will catch
376+
* the problem and should stop the system from crashing.
377+
* 20030610 - [email protected]
378+
*/
379+
if (pci_enable_device(pdev)) {
380+
printk(KERN_ERR PFX "Unable to Enable PCI device\n");
381+
agp_put_bridge(bridge);
382+
return -ENODEV;
383+
}
384+
374385
/*
375386
* The following fixes the case where the BIOS has "forgotten" to
376387
* provide an address range for the GART.
@@ -385,17 +396,6 @@ static int __devinit agp_efficeon_probe(struct pci_dev *pdev,
385396
}
386397
}
387398

388-
/*
389-
* If the device has not been properly setup, the following will catch
390-
* the problem and should stop the system from crashing.
391-
* 20030610 - [email protected]
392-
*/
393-
if (pci_enable_device(pdev)) {
394-
printk(KERN_ERR PFX "Unable to Enable PCI device\n");
395-
agp_put_bridge(bridge);
396-
return -ENODEV;
397-
}
398-
399399
/* Fill in the mode register */
400400
if (cap_ptr) {
401401
pci_read_config_dword(pdev,

0 commit comments

Comments
 (0)