intel/tools: Fix aubinator usage of rb_tree.
authorRafael Antognolli <rafael.antognolli@intel.com>
Mon, 30 Sep 2019 19:34:12 +0000 (12:34 -0700)
committerRafael Antognolli <rafael.antognolli@intel.com>
Mon, 30 Sep 2019 20:43:23 +0000 (13:43 -0700)
The order of comparison has changed, so we need to invert the logic of
"insert_left" when using rb_tree_insert_at().

Fixes: dae33052dbf (util/rb_tree: Reverse the order of comparison
                    functions).
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
src/intel/tools/aub_mem.c

index 2f70afc8b76eca604ad3c98d614ad04e7090ba57..5dd1c6184437007cc1c5736352aeb325a9cb000f 100644 (file)
@@ -109,7 +109,7 @@ ensure_ggtt_entry(struct aub_mem *mem, uint64_t virt_addr)
    if (!node || (cmp = cmp_ggtt_entry(node, &virt_addr))) {
       struct ggtt_entry *new_entry = calloc(1, sizeof(*new_entry));
       new_entry->virt_addr = virt_addr;
-      rb_tree_insert_at(&mem->ggtt, node, &new_entry->node, cmp > 0);
+      rb_tree_insert_at(&mem->ggtt, node, &new_entry->node, cmp < 0);
       node = &new_entry->node;
    }
 
@@ -153,7 +153,7 @@ ensure_phys_mem(struct aub_mem *mem, uint64_t phys_addr)
                            mem->mem_fd, new_mem->fd_offset);
       assert(new_mem->data != MAP_FAILED);
 
-      rb_tree_insert_at(&mem->mem, node, &new_mem->node, cmp > 0);
+      rb_tree_insert_at(&mem->mem, node, &new_mem->node, cmp < 0);
       node = &new_mem->node;
    }