mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 11/11] sis: do not use PCI resources before pci_enable_device()
@ 2010-08-03 15:44 Kulikov Vasiliy
  0 siblings, 0 replies; only message in thread
From: Kulikov Vasiliy @ 2010-08-03 15:44 UTC (permalink / raw)
  To: kernel-janitors
  Cc: Thomas Winischhofer, Andrew Morton, Roel Kluin, Dan Carpenter,
	Christoph Egger, linux-kernel

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>
---
 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


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2010-08-03 15:44 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-08-03 15:44 [PATCH 11/11] sis: do not use PCI resources before pci_enable_device() Kulikov Vasiliy

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®