Commit 510c0732 authored by James Chapman's avatar James Chapman Committed by Jakub Kicinski

l2tp: remove unneeded null check in l2tp_v2_session_get_next

Commit aa92c1ce ("l2tp: add tunnel/session get_next helpers") uses
idr_get_next APIs to iterate over l2tp session IDR lists.  Sessions in
l2tp_v2_session_idr always have a non-null session->tunnel pointer
since l2tp_session_register sets it before inserting the session into
the IDR. Therefore the null check on session->tunnel in
l2tp_v2_session_get_next is redundant and can be removed. Removing the
check avoids a warning from lkp.
Reported-by: default avatarkernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/r/202408111407.HtON8jqa-lkp@intel.com/
CC: Dan Carpenter <dan.carpenter@linaro.org>
Signed-off-by: default avatarJames Chapman <jchapman@katalix.com>
Acked-by: default avatarTom Parkin <tparkin@katalix.com>
Reviewed-by: default avatarSimon Horman <horms@kernel.org>
Link: https://patch.msgid.link/20240903113547.1261048-1-jchapman@katalix.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 17053414
......@@ -345,7 +345,7 @@ static struct l2tp_session *l2tp_v2_session_get_next(const struct net *net,
goto again;
}
if (tunnel && tunnel->tunnel_id == tid &&
if (tunnel->tunnel_id == tid &&
refcount_inc_not_zero(&session->ref_count)) {
rcu_read_unlock_bh();
return session;
......
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