Commit 536a631d authored by Parav Pandit's avatar Parav Pandit Committed by Doug Ledford

IB/rxe: Avoid NULL check when search is successful

While performing lookup in a pool, if entry is found, take the
reference right there, instead of checking again outside the loop and
save one branch.
Signed-off-by: default avatarParav Pandit <parav@mellanox.com>
Reviewed-by: default avatarDaniel Jurgens <danielj@mellanox.com>
Signed-off-by: default avatarLeon Romanovsky <leonro@mellanox.com>
Reviewed-by: default avatarYuval Shaia <yuval.shaia@oracle.com>
Signed-off-by: default avatarDoug Ledford <dledford@redhat.com>
parent 3ccf19e2
......@@ -450,12 +450,11 @@ void *rxe_pool_get_index(struct rxe_pool *pool, u32 index)
node = node->rb_left;
else if (elem->index < index)
node = node->rb_right;
else
else {
kref_get(&elem->ref_cnt);
break;
}
if (node)
kref_get(&elem->ref_cnt);
}
out:
read_unlock_irqrestore(&pool->pool_lock, flags);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment