mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-06 00:41:20 +00:00
Merge pull request #5911 from ton31337/fix/no_check_if_assert
bgpd: Remove a test and return statement after assert
This commit is contained in:
commit
fbb0740683
@ -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);
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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));
|
||||
|
7
scripts/coccinelle/test_after_assert.cocci
Normal file
7
scripts/coccinelle/test_after_assert.cocci
Normal file
@ -0,0 +1,7 @@
|
||||
@@
|
||||
identifier i;
|
||||
@@
|
||||
|
||||
assert(i);
|
||||
- if (!i)
|
||||
- return ...;
|
Loading…
Reference in New Issue
Block a user