From: anlan_cs Date: Sun, 6 Feb 2022 03:59:09 +0000 (-0500) Subject: zebra: use "assert" instead of unnecessary check X-Git-Tag: pim6-testing-20220430~212^2 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=df44783078d69db1a154b7a619719340da00621b;p=matthieu%2Ffrr.git zebra: use "assert" instead of unnecessary check Since `zvni_map_to_svi_ns()` is used to find and return one specific interface based on passed attributes of SVI, so the two parameters `in_param` and `p_ifp` must not be NULL. Passing NULL `p_ifp` makes no sense, so the check `if (p_ifp)` is unnecessary. So use `assert` to ensure the two parameters, and remove that unnecessary check. Signed-off-by: anlan_cs --- diff --git a/zebra/zebra_vxlan.c b/zebra/zebra_vxlan.c index b6da445e38..4fdd54ffde 100644 --- a/zebra/zebra_vxlan.c +++ b/zebra/zebra_vxlan.c @@ -826,8 +826,7 @@ static int zvni_map_to_svi_ns(struct ns *ns, struct interface **p_ifp = (struct interface **)_p_ifp; struct zebra_if *zif; - if (!in_param) - return NS_WALK_STOP; + assert(in_param && p_ifp); /* TODO: Optimize with a hash. */ for (rn = route_top(zns->if_table); rn; rn = route_next(rn)) { @@ -842,8 +841,7 @@ static int zvni_map_to_svi_ns(struct ns *ns, vl = (struct zebra_l2info_vlan *)&zif->l2info.vl; if (vl->vid == in_param->vid) { - if (p_ifp) - *p_ifp = tmp_if; + *p_ifp = tmp_if; return NS_WALK_STOP; } }