Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

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

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
Loading
Loading
Loading
Loading
+3 −4
Original line number Diff line number Diff line
@@ -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);