Patchwork [2/3] memory: Do not print empty PIO root

login
register
mail settings
Submitter Jan Kiszka
Date Sept. 27, 2011, 1 p.m.
Message ID <4E81C8F6.2060502@siemens.com>
Download mbox | patch
Permalink /patch/116601/
State New
Headers show

Comments

Jan Kiszka - Sept. 27, 2011, 1 p.m.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
 memory.c |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

Patch

diff --git a/memory.c b/memory.c
index 4c190e5..24c5abd 100644
--- a/memory.c
+++ b/memory.c
@@ -1414,7 +1414,10 @@  void mtree_info(fprintf_function mon_printf, void *f)
         g_free(ml2);
     }
 
-    QTAILQ_INIT(&ml_head);
-    mon_printf(f, "I/O\n");
-    mtree_print_mr(mon_printf, f, address_space_io.root, 0, 0, &ml_head);
+    if (address_space_io.root &&
+        !QTAILQ_EMPTY(&address_space_io.root->subregions)) {
+        QTAILQ_INIT(&ml_head);
+        mon_printf(f, "I/O\n");
+        mtree_print_mr(mon_printf, f, address_space_io.root, 0, 0, &ml_head);
+    }
 }