diff options
author | Dean Luick <dean.luick@intel.com> | 2016-07-28 12:27:36 -0400 |
---|---|---|
committer | Doug Ledford <dledford@redhat.com> | 2016-08-02 22:46:21 -0400 |
commit | 20a42d08331c888207d81d8e4713e18250ac49cf (patch) | |
tree | 57f019e8a0162b06d8c6b44e56d2d66c091efcf9 /drivers/infiniband/hw/hfi1/mmu_rb.c | |
parent | ea3a0ee52db0c2ec8d1d0ecdd21e650e6e183085 (diff) | |
download | linux-stable-20a42d08331c888207d81d8e4713e18250ac49cf.tar.gz linux-stable-20a42d08331c888207d81d8e4713e18250ac49cf.tar.bz2 linux-stable-20a42d08331c888207d81d8e4713e18250ac49cf.zip |
IB/hfi1: Remove unneeded empty check in hfi1_mmu_rb_unregister()
Checking if the rb tree is empty is redundant with the while loop which is
emptying the rb tree.
Reviewed-by: Ira Weiny <ira.weiny@intel.com>
Signed-off-by: Dean Luick <dean.luick@intel.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
Diffstat (limited to 'drivers/infiniband/hw/hfi1/mmu_rb.c')
-rw-r--r-- | drivers/infiniband/hw/hfi1/mmu_rb.c | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/drivers/infiniband/hw/hfi1/mmu_rb.c b/drivers/infiniband/hw/hfi1/mmu_rb.c index b845adf9fc0e..1c7e25b90a2c 100644 --- a/drivers/infiniband/hw/hfi1/mmu_rb.c +++ b/drivers/infiniband/hw/hfi1/mmu_rb.c @@ -118,6 +118,8 @@ int hfi1_mmu_rb_register(struct rb_root *root, struct mmu_rb_ops *ops) void hfi1_mmu_rb_unregister(struct rb_root *root) { struct mmu_rb_handler *handler = find_mmu_handler(root); + struct mmu_rb_node *rbnode; + struct rb_node *node; unsigned long flags; if (!handler) @@ -133,15 +135,10 @@ void hfi1_mmu_rb_unregister(struct rb_root *root) synchronize_rcu(); spin_lock_irqsave(&handler->lock, flags); - if (!RB_EMPTY_ROOT(root)) { - struct rb_node *node; - struct mmu_rb_node *rbnode; - - while ((node = rb_first(root))) { - rbnode = rb_entry(node, struct mmu_rb_node, node); - rb_erase(node, root); - handler->ops->remove(root, rbnode, NULL); - } + while ((node = rb_first(root))) { + rbnode = rb_entry(node, struct mmu_rb_node, node); + rb_erase(node, root); + handler->ops->remove(root, rbnode, NULL); } spin_unlock_irqrestore(&handler->lock, flags); |