Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bgpd: Remove a test and return statement after assert #5911

Merged
merged 2 commits into from
Mar 5, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions bgpd/bgp_route.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down Expand Up @@ -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);

Expand Down
2 changes: 0 additions & 2 deletions bgpd/bgp_updgrp_packet.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 0 additions & 2 deletions bgpd/bgpd.c
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down
7 changes: 7 additions & 0 deletions scripts/coccinelle/test_after_assert.cocci
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
@@
identifier i;
@@

assert(i);
- if (!i)
- return ...;