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:
Родитель
3ccf19e25a
Коммит
536a631d1e
|
@ -450,13 +450,12 @@ 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);
|
||||
return node ? elem : NULL;
|
||||
|
|
Загрузка…
Ссылка в новой задаче