Prev: uio: do not use PCI resources before pci_enable_device()
Next: [PATCH 03/11] cxgb3: do not use PCI resources before pci_enable_device()
From: Kulikov Vasiliy on 3 Aug 2010 11:50 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(a)gmail.com> --- drivers/video/sis/sis_main.c | 13 +++++-------- 1 files changed, 5 insertions(+), 8 deletions(-) diff --git a/drivers/video/sis/sis_main.c b/drivers/video/sis/sis_main.c index 559bf17..47ba64e 100644 --- a/drivers/video/sis/sis_main.c +++ b/drivers/video/sis/sis_main.c @@ -5782,6 +5782,11 @@ sisfb_probe(struct pci_dev *pdev, const struct pci_device_id *ent) ivideo->subsysvendor = pdev->subsystem_vendor; ivideo->subsysdevice = pdev->subsystem_device; + if (!ivideo->sisvga_enabled && pci_enable_device(pdev)) { + framebuffer_release(sis_fb_info); + return -EIO; + } + #ifndef MODULE if(sisfb_mode_idx == -1) { sisfb_get_vga_mode_from_kernel(); @@ -5923,14 +5928,6 @@ sisfb_probe(struct pci_dev *pdev, const struct pci_device_id *ent) } #endif - if(!ivideo->sisvga_enabled) { - if(pci_enable_device(pdev)) { - if(ivideo->nbridge) pci_dev_put(ivideo->nbridge); - pci_set_drvdata(pdev, NULL); - framebuffer_release(sis_fb_info); - return -EIO; - } - } ivideo->video_base = pci_resource_start(pdev, 0); ivideo->mmio_base = pci_resource_start(pdev, 1); -- 1.7.0.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo(a)vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/ |