Skip to content

Commit 96576a9

Browse files
segoonairlied
authored andcommitted
agp: intel-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 46cfc58 commit 96576a9

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

drivers/char/agp/intel-agp.c

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -907,6 +907,17 @@ static int __devinit agp_intel_probe(struct pci_dev *pdev,
907907

908908
dev_info(&pdev->dev, "Intel %s Chipset\n", intel_agp_chipsets[i].name);
909909

910+
/*
911+
* If the device has not been properly setup, the following will catch
912+
* the problem and should stop the system from crashing.
913+
* 20030610 - [email protected]
914+
*/
915+
if (pci_enable_device(pdev)) {
916+
dev_err(&pdev->dev, "can't enable PCI device\n");
917+
agp_put_bridge(bridge);
918+
return -ENODEV;
919+
}
920+
910921
/*
911922
* The following fixes the case where the BIOS has "forgotten" to
912923
* provide an address range for the GART.
@@ -921,17 +932,6 @@ static int __devinit agp_intel_probe(struct pci_dev *pdev,
921932
}
922933
}
923934

924-
/*
925-
* If the device has not been properly setup, the following will catch
926-
* the problem and should stop the system from crashing.
927-
* 20030610 - [email protected]
928-
*/
929-
if (pci_enable_device(pdev)) {
930-
dev_err(&pdev->dev, "can't enable PCI device\n");
931-
agp_put_bridge(bridge);
932-
return -ENODEV;
933-
}
934-
935935
/* Fill in the mode register */
936936
if (cap_ptr) {
937937
pci_read_config_dword(pdev,

0 commit comments

Comments
 (0)