aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2011-12-19 20:33:59 +0000
committerAnthony Liguori <aliguori@us.ibm.com>2011-12-20 15:44:31 -0600
commite114fead273e2a7d453c2fb67c74cad58c34581d (patch)
treea4974e5a82f21f25ed977131931fca24176ff837
parent42ed3727536ccf80c87942b3f04e7378fe90f107 (diff)
hw/sysbus.c: Remove unnecessary conditionals
Now that all sysbus MMIO regions are MemoryRegions, mmio[n].memory is never NULL, and we can remove some unnecessary conditionals. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
-rw-r--r--hw/sysbus.c18
1 files changed, 5 insertions, 13 deletions
diff --git a/hw/sysbus.c b/hw/sysbus.c
index 81a57bdba8..24f619f65c 100644
--- a/hw/sysbus.c
+++ b/hw/sysbus.c
@@ -50,17 +50,12 @@ void sysbus_mmio_map(SysBusDevice *dev, int n, target_phys_addr_t addr)
}
if (dev->mmio[n].addr != (target_phys_addr_t)-1) {
/* Unregister previous mapping. */
- if (dev->mmio[n].memory) {
- memory_region_del_subregion(get_system_memory(),
- dev->mmio[n].memory);
- }
+ memory_region_del_subregion(get_system_memory(), dev->mmio[n].memory);
}
dev->mmio[n].addr = addr;
- if (dev->mmio[n].memory) {
- memory_region_add_subregion(get_system_memory(),
- addr,
- dev->mmio[n].memory);
- }
+ memory_region_add_subregion(get_system_memory(),
+ addr,
+ dev->mmio[n].memory);
}
@@ -206,10 +201,7 @@ static void sysbus_dev_print(Monitor *mon, DeviceState *dev, int indent)
monitor_printf(mon, "%*sirq %d\n", indent, "", s->num_irq);
for (i = 0; i < s->num_mmio; i++) {
- size = 0;
- if (s->mmio[i].memory) {
- size = memory_region_size(s->mmio[i].memory);
- }
+ size = memory_region_size(s->mmio[i].memory);
monitor_printf(mon, "%*smmio " TARGET_FMT_plx "/" TARGET_FMT_plx "\n",
indent, "", s->mmio[i].addr, size);
}