qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [RFC PATCH v1 07/25] sysbus: mmio_map+mmio_get_region: igno


From: Peter Crosthwaite
Subject: [Qemu-devel] [RFC PATCH v1 07/25] sysbus: mmio_map+mmio_get_region: ignore range OOB errors
Date: Thu, 10 Sep 2015 22:33:17 -0700

Ignore these errors as they may be a follow on effect of device
realisation failure. Ideally we should have an error ** to populate
in own right, but that requires an API change. Mark FIXME.

Signed-off-by: Peter Crosthwaite <address@hidden>
---

 hw/core/sysbus.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/hw/core/sysbus.c b/hw/core/sysbus.c
index 3c58629..6fde10e 100644
--- a/hw/core/sysbus.c
+++ b/hw/core/sysbus.c
@@ -127,7 +127,12 @@ bool sysbus_has_mmio(SysBusDevice *dev, unsigned int n)
 static void sysbus_mmio_map_common(SysBusDevice *dev, int n, hwaddr addr,
                                    bool may_overlap, int priority)
 {
-    assert(n >= 0 && n < dev->num_mmio);
+    assert(n >= 0);
+
+    if (n < dev->num_mmio) {
+        /* FIXME: Add an Error ** to this function for this condition */
+        return;
+    }
 
     if (dev->mmio[n].addr == addr) {
         /* ??? region already mapped here.  */
@@ -186,6 +191,10 @@ void sysbus_init_mmio(SysBusDevice *dev, MemoryRegion 
*memory)
 
 MemoryRegion *sysbus_mmio_get_region(SysBusDevice *dev, int n)
 {
+    if (n >= dev->num_mmio) {
+        /* FIXME: Add an Error ** to this function for this condition */
+        return NULL;
+    }
     return dev->mmio[n].memory;
 }
 
-- 
1.9.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]