From ce089777d45fac8199c7e7682cb00adb051ae6d0 Mon Sep 17 00:00:00 2001 From: Donatas Abraitis Date: Wed, 4 Mar 2020 20:19:12 +0200 Subject: [PATCH] bgpd: Remove a test and return statement after assert No need to check if the variable is NULL and return after assert. Signed-off-by: Donatas Abraitis --- bgpd/bgp_route.c | 4 ---- bgpd/bgp_updgrp_packet.c | 2 -- bgpd/bgpd.c | 2 -- 3 files changed, 8 deletions(-) diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c index 1cd0bbe578..e486dc4fb9 100644 --- a/bgpd/bgp_route.c +++ b/bgpd/bgp_route.c @@ -122,8 +122,6 @@ struct bgp_node *bgp_afi_node_get(struct bgp_table *table, afi_t afi, struct bgp_node *prn = NULL; assert(table); - if (!table) - return NULL; if ((safi == SAFI_MPLS_VPN) || (safi == SAFI_ENCAP) || (safi == SAFI_EVPN)) { @@ -4909,8 +4907,6 @@ void bgp_static_update(struct bgp *bgp, struct prefix *p, #endif assert(bgp_static); - if (!bgp_static) - return; rn = bgp_afi_node_get(bgp->rib[afi][safi], afi, safi, p, NULL); diff --git a/bgpd/bgp_updgrp_packet.c b/bgpd/bgp_updgrp_packet.c index 89199d05cb..4dc9dfa39a 100644 --- a/bgpd/bgp_updgrp_packet.c +++ b/bgpd/bgp_updgrp_packet.c @@ -330,8 +330,6 @@ void bpacket_queue_remove_peer(struct peer_af *paf) q = PAF_PKTQ(paf); assert(q); - if (!q) - return; LIST_REMOVE(paf, pkt_train); paf->next_pkt_to_send = NULL; diff --git a/bgpd/bgpd.c b/bgpd/bgpd.c index 96b307ee21..12e91d333f 100644 --- a/bgpd/bgpd.c +++ b/bgpd/bgpd.c @@ -1200,8 +1200,6 @@ struct peer *peer_new(struct bgp *bgp) /* bgp argument is absolutely required */ assert(bgp); - if (!bgp) - return NULL; /* Allocate new peer. */ peer = XCALLOC(MTYPE_BGP_PEER, sizeof(struct peer)); -- 2.39.5