]> git.puffer.fish Git - mirror/frr.git/commitdiff
bgpd: remove check returning value of RB_INSERT() 10830/head
authoranlan_cs <vic.lan@pica8.com>
Sat, 19 Mar 2022 05:15:09 +0000 (13:15 +0800)
committeranlan_cs <vic.lan@pica8.com>
Sun, 20 Mar 2022 09:13:29 +0000 (17:13 +0800)
Since the `RB_INSERT()` is called after not found in RB tree, it MUST be ok and
and return zero. The check of returning value of `RB_INSERT()` is redundant,
just remove them.

Signed-off-by: anlan_cs <vic.lan@pica8.com>
bgpd/bgp_evpn_mh.c

index ea179ec2b48d201d21b5a77aa00a01536f20f61e..ffaf8c55b9eed17c473f337e848bf782660d330b 100644 (file)
@@ -1651,10 +1651,7 @@ static struct bgp_evpn_es *bgp_evpn_es_new(struct bgp *bgp, const esi_t *esi)
        es->route_table = bgp_table_init(bgp, AFI_L2VPN, SAFI_EVPN);
 
        /* Add to rb_tree */
-       if (RB_INSERT(bgp_es_rb_head, &bgp_mh_info->es_rb_tree, es)) {
-               XFREE(MTYPE_BGP_EVPN_ES, es);
-               return NULL;
-       }
+       RB_INSERT(bgp_es_rb_head, &bgp_mh_info->es_rb_tree, es);
 
        /* Initialise the ES-EVI list */
        es->es_evi_list = list_new();
@@ -2716,10 +2713,7 @@ static struct bgp_evpn_es_vrf *bgp_evpn_es_vrf_create(struct bgp_evpn_es *es,
        es_vrf->bgp_vrf = bgp_vrf;
 
        /* insert into the VRF-ESI rb tree */
-       if (RB_INSERT(bgp_es_vrf_rb_head, &bgp_vrf->es_vrf_rb_tree, es_vrf)) {
-               XFREE(MTYPE_BGP_EVPN_ES_VRF, es_vrf);
-               return NULL;
-       }
+       RB_INSERT(bgp_es_vrf_rb_head, &bgp_vrf->es_vrf_rb_tree, es_vrf);
 
        /* add to the ES's VRF list */
        listnode_init(&es_vrf->es_listnode, es_vrf);
@@ -3259,10 +3253,7 @@ static struct bgp_evpn_es_evi *bgp_evpn_es_evi_new(struct bgp_evpn_es *es,
        es_evi->es_evi_vtep_list->cmp = bgp_evpn_es_evi_vtep_cmp;
 
        /* insert into the VNI-ESI rb tree */
-       if (RB_INSERT(bgp_es_evi_rb_head, &vpn->es_evi_rb_tree, es_evi)) {
-               XFREE(MTYPE_BGP_EVPN_ES_EVI, es_evi);
-               return NULL;
-       }
+       RB_INSERT(bgp_es_evi_rb_head, &vpn->es_evi_rb_tree, es_evi);
 
        /* add to the ES's VNI list */
        listnode_init(&es_evi->es_listnode, es_evi);