a678cac
From 656ca314bb97341a07d4bbd7fcfe7af9a3689761 Mon Sep 17 00:00:00 2001
a678cac
From: Dave Airlie <airlied@panoply-rh.(none)>
a678cac
Date: Thu, 13 Mar 2008 16:16:46 +1000
a678cac
Subject: [PATCH] fbdev: make entity fail if PCI claimed already.
a678cac
a678cac
bad kitty fbdev.
a678cac
---
a678cac
 hw/xfree86/common/xf86Bus.c   |    3 +++
a678cac
 hw/xfree86/common/xf86fbBus.c |    3 +++
a678cac
 2 files changed, 6 insertions(+), 0 deletions(-)
a678cac
a678cac
diff --git a/hw/xfree86/common/xf86Bus.c b/hw/xfree86/common/xf86Bus.c
a678cac
index f7ffac8..9f4e0ca 100644
a678cac
--- a/hw/xfree86/common/xf86Bus.c
a678cac
+++ b/hw/xfree86/common/xf86Bus.c
a678cac
@@ -458,6 +458,9 @@ xf86GetEntityInfo(int entityIndex)
a678cac
     EntityInfoPtr pEnt;
a678cac
     int i;
a678cac
     
a678cac
+    if (entityIndex == -1)
a678cac
+	return NULL;
a678cac
+
a678cac
     if (entityIndex >= xf86NumEntities)
a678cac
 	return NULL;
a678cac
     
a678cac
diff --git a/hw/xfree86/common/xf86fbBus.c b/hw/xfree86/common/xf86fbBus.c
a678cac
index 102f6b1..48e101b 100644
a678cac
--- a/hw/xfree86/common/xf86fbBus.c
a678cac
+++ b/hw/xfree86/common/xf86fbBus.c
a678cac
@@ -58,6 +58,9 @@ xf86ClaimFbSlot(DriverPtr drvp, int chipset, GDevPtr dev, Bool active)
a678cac
 {
a678cac
     EntityPtr p;
a678cac
     int num;
a678cac
+
a678cac
+    if (pciSlotClaimed)
a678cac
+	return -1;
a678cac
     
a678cac
     num = xf86AllocateEntity();
a678cac
     p = xf86Entities[num];
a678cac
-- 
a678cac
1.5.4.3
a678cac