forked from Minki/linux
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: Parav Pandit <parav@mellanox.com> Reviewed-by: Daniel Jurgens <danielj@mellanox.com> Signed-off-by: Leon Romanovsky <leonro@mellanox.com> Reviewed-by: Yuval Shaia <yuval.shaia@oracle.com> Signed-off-by: Doug Ledford <dledford@redhat.com>
This commit is contained in:
parent
3ccf19e25a
commit
536a631d1e
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user