summaryrefslogtreecommitdiffstats
path: root/zebra
diff options
context:
space:
mode:
authorDavid Lamparter <equinox@diac24.net>2019-03-06 15:54:44 +0100
committerGitHub <noreply@github.com>2019-03-06 15:54:44 +0100
commitd3b05897edff14ceb71c2f5603a9fcdb1ae10c83 (patch)
tree274b088939d9686c289d5de95d70cdb39a01e4b4 /zebra
parentRevert "nhrpd: strncpy -> strlcpy" (diff)
parenttools: add coccinelle spatches (diff)
downloadfrr-d3b05897edff14ceb71c2f5603a9fcdb1ae10c83.tar.xz
frr-d3b05897edff14ceb71c2f5603a9fcdb1ae10c83.zip
Merge pull request #3869 from qlyoung/cocci-fixes
Assorted Coccinelle fixes
Diffstat (limited to 'zebra')
-rw-r--r--zebra/if_netlink.c3
-rw-r--r--zebra/zebra_dplane.c12
-rw-r--r--zebra/zebra_mpls.c21
-rw-r--r--zebra/zebra_mpls_openbsd.c2
-rw-r--r--zebra/zebra_pbr.c2
-rw-r--r--zebra/zebra_ptm.c2
-rw-r--r--zebra/zebra_rib.c3
-rw-r--r--zebra/zebra_routemap.c6
-rw-r--r--zebra/zebra_vrf.c3
-rw-r--r--zebra/zebra_vxlan.c18
10 files changed, 23 insertions, 49 deletions
diff --git a/zebra/if_netlink.c b/zebra/if_netlink.c
index 3583d63d3..b2f470bc8 100644
--- a/zebra/if_netlink.c
+++ b/zebra/if_netlink.c
@@ -1194,8 +1194,7 @@ int netlink_link_change(struct nlmsghdr *h, ns_id_t ns_id, int startup)
ifp = if_lookup_by_name_per_ns(zns, name);
if (ifp) {
- if (ifp->desc)
- XFREE(MTYPE_TMP, ifp->desc);
+ XFREE(MTYPE_TMP, ifp->desc);
if (desc)
ifp->desc = XSTRDUP(MTYPE_TMP, desc);
}
diff --git a/zebra/zebra_dplane.c b/zebra/zebra_dplane.c
index 928169a86..894914e57 100644
--- a/zebra/zebra_dplane.c
+++ b/zebra/zebra_dplane.c
@@ -520,7 +520,7 @@ const char *dplane_op2str(enum dplane_op_e op)
ret = "PW_UNINSTALL";
break;
- };
+ }
return ret;
}
@@ -539,7 +539,7 @@ const char *dplane_res2str(enum zebra_dplane_result res)
case ZEBRA_DPLANE_REQUEST_SUCCESS:
ret = "SUCCESS";
break;
- };
+ }
return ret;
}
@@ -1039,8 +1039,6 @@ static int dplane_ctx_pw_init(struct zebra_dplane_ctx *ctx,
enum dplane_op_e op,
struct zebra_pw *pw)
{
- int ret = AOK;
-
if (IS_ZEBRA_DEBUG_DPLANE_DETAIL)
zlog_debug("init dplane ctx %s: pw '%s', loc %u, rem %u",
dplane_op2str(op), pw->ifname, pw->local_label,
@@ -1070,7 +1068,7 @@ static int dplane_ctx_pw_init(struct zebra_dplane_ctx *ctx,
ctx->u.pw.fields = pw->data;
- return ret;
+ return AOK;
}
/*
@@ -1476,10 +1474,6 @@ int dplane_provider_register(const char *name,
/* Allocate and init new provider struct */
p = XCALLOC(MTYPE_DP_PROV, sizeof(struct zebra_dplane_provider));
- if (p == NULL) {
- ret = ENOMEM;
- goto done;
- }
pthread_mutex_init(&(p->dp_mutex), NULL);
TAILQ_INIT(&(p->dp_ctx_in_q));
diff --git a/zebra/zebra_mpls.c b/zebra/zebra_mpls.c
index a06e15d90..5c375a6be 100644
--- a/zebra/zebra_mpls.c
+++ b/zebra/zebra_mpls.c
@@ -249,8 +249,7 @@ static int lsp_install(struct zebra_vrf *zvrf, mpls_label_t label,
lsp->ile.in_label, lsp->flags);
lsp = hash_release(lsp_table, &lsp->ile);
- if (lsp)
- XFREE(MTYPE_LSP, lsp);
+ XFREE(MTYPE_LSP, lsp);
}
return 0;
@@ -313,8 +312,7 @@ static int lsp_uninstall(struct zebra_vrf *zvrf, mpls_label_t label)
lsp->ile.in_label, lsp->flags);
lsp = hash_release(lsp_table, &lsp->ile);
- if (lsp)
- XFREE(MTYPE_LSP, lsp);
+ XFREE(MTYPE_LSP, lsp);
}
return 0;
@@ -1048,8 +1046,7 @@ static void lsp_processq_del(struct work_queue *wq, void *data)
lsp->ile.in_label, lsp->flags);
lsp = hash_release(lsp_table, &lsp->ile);
- if (lsp)
- XFREE(MTYPE_LSP, lsp);
+ XFREE(MTYPE_LSP, lsp);
}
}
@@ -1335,8 +1332,7 @@ static int mpls_lsp_uninstall_all(struct hash *lsp_table, zebra_lsp_t *lsp,
lsp->ile.in_label, lsp->flags);
lsp = hash_release(lsp_table, &lsp->ile);
- if (lsp)
- XFREE(MTYPE_LSP, lsp);
+ XFREE(MTYPE_LSP, lsp);
}
return 0;
@@ -1659,8 +1655,7 @@ static int snhlfe_del(zebra_snhlfe_t *snhlfe)
slsp->snhlfe_list = snhlfe->next;
snhlfe->prev = snhlfe->next = NULL;
- if (snhlfe->ifname)
- XFREE(MTYPE_SNHLFE_IFNAME, snhlfe->ifname);
+ XFREE(MTYPE_SNHLFE_IFNAME, snhlfe->ifname);
XFREE(MTYPE_SNHLFE, snhlfe);
return 0;
@@ -2539,8 +2534,7 @@ int mpls_lsp_uninstall(struct zebra_vrf *zvrf, enum lsp_types_t type,
lsp->ile.in_label, lsp->flags);
lsp = hash_release(lsp_table, &lsp->ile);
- if (lsp)
- XFREE(MTYPE_LSP, lsp);
+ XFREE(MTYPE_LSP, lsp);
}
}
return 0;
@@ -2784,8 +2778,7 @@ int zebra_mpls_static_lsp_del(struct zebra_vrf *zvrf, mpls_label_t in_label,
* above. */
if (!slsp->snhlfe_list) {
slsp = hash_release(slsp_table, &tmp_ile);
- if (slsp)
- XFREE(MTYPE_SLSP, slsp);
+ XFREE(MTYPE_SLSP, slsp);
}
return 0;
diff --git a/zebra/zebra_mpls_openbsd.c b/zebra/zebra_mpls_openbsd.c
index 72c8f7352..ade36cbce 100644
--- a/zebra/zebra_mpls_openbsd.c
+++ b/zebra/zebra_mpls_openbsd.c
@@ -415,7 +415,7 @@ enum zebra_dplane_result kernel_pw_update(struct zebra_dplane_ctx *ctx)
break;
default:
break;
- };
+ }
return result;
}
diff --git a/zebra/zebra_pbr.c b/zebra/zebra_pbr.c
index 348bdeb9f..73db567ea 100644
--- a/zebra/zebra_pbr.c
+++ b/zebra/zebra_pbr.c
@@ -388,7 +388,7 @@ bool zebra_pbr_iptable_hash_equal(const void *arg1, const void *arg2)
r2 = (const struct zebra_pbr_iptable *)arg2;
if (r1->vrf_id != r2->vrf_id)
- return 0;
+ return false;
if (r1->type != r2->type)
return false;
if (r1->unique != r2->unique)
diff --git a/zebra/zebra_ptm.c b/zebra/zebra_ptm.c
index 1e942d643..cc5e38e69 100644
--- a/zebra/zebra_ptm.c
+++ b/zebra/zebra_ptm.c
@@ -1215,8 +1215,6 @@ static struct ptm_process *pp_new(pid_t pid, struct zserv *zs)
/* Allocate and register new process. */
pp = XCALLOC(MTYPE_ZEBRA_PTM_BFD_PROCESS, sizeof(*pp));
- if (pp == NULL)
- return NULL;
pp->pp_pid = pid;
pp->pp_zs = zs;
diff --git a/zebra/zebra_rib.c b/zebra/zebra_rib.c
index de1aa7d6d..2014aa3be 100644
--- a/zebra/zebra_rib.c
+++ b/zebra/zebra_rib.c
@@ -3235,7 +3235,6 @@ void rib_close_table(struct route_table *table)
*/
static int handle_pw_result(struct zebra_dplane_ctx *ctx)
{
- int ret = 0;
struct zebra_pw *pw;
struct zebra_vrf *vrf;
@@ -3254,7 +3253,7 @@ static int handle_pw_result(struct zebra_dplane_ctx *ctx)
done:
- return ret;
+ return 0;
}
diff --git a/zebra/zebra_routemap.c b/zebra/zebra_routemap.c
index 7d72583dd..5d1cbbe78 100644
--- a/zebra/zebra_routemap.c
+++ b/zebra/zebra_routemap.c
@@ -127,10 +127,8 @@ static int zebra_route_match_delete(struct vty *vty, const char *command,
break;
}
- if (dep_name)
- XFREE(MTYPE_ROUTE_MAP_RULE, dep_name);
- if (rmap_name)
- XFREE(MTYPE_ROUTE_MAP_NAME, rmap_name);
+ XFREE(MTYPE_ROUTE_MAP_RULE, dep_name);
+ XFREE(MTYPE_ROUTE_MAP_NAME, rmap_name);
return retval;
}
diff --git a/zebra/zebra_vrf.c b/zebra/zebra_vrf.c
index d18305495..d42aad0d2 100644
--- a/zebra/zebra_vrf.c
+++ b/zebra/zebra_vrf.c
@@ -351,8 +351,7 @@ void zebra_rtable_node_cleanup(struct route_table *table,
rib_unlink(node, re);
}
- if (node->info)
- XFREE(MTYPE_RIB_DEST, node->info);
+ XFREE(MTYPE_RIB_DEST, node->info);
}
static void zebra_rnhtable_node_cleanup(struct route_table *table,
diff --git a/zebra/zebra_vxlan.c b/zebra/zebra_vxlan.c
index 4cd70381c..16a47f9c4 100644
--- a/zebra/zebra_vxlan.c
+++ b/zebra/zebra_vxlan.c
@@ -2213,8 +2213,7 @@ static int zvni_neigh_del(zebra_vni_t *zvni, zebra_neigh_t *n)
/* Free the VNI hash entry and allocated memory. */
tmp_n = hash_release(zvni->neigh_table, n);
- if (tmp_n)
- XFREE(MTYPE_NEIGH, tmp_n);
+ XFREE(MTYPE_NEIGH, tmp_n);
return 0;
}
@@ -3309,8 +3308,7 @@ static int zvni_mac_del(zebra_vni_t *zvni, zebra_mac_t *mac)
/* Free the VNI hash entry and allocated memory. */
tmp_mac = hash_release(zvni->mac_table, mac);
- if (tmp_mac)
- XFREE(MTYPE_MAC, tmp_mac);
+ XFREE(MTYPE_MAC, tmp_mac);
return 0;
}
@@ -3862,8 +3860,7 @@ static int zvni_del(zebra_vni_t *zvni)
/* Free the VNI hash entry and allocated memory. */
tmp_zvni = hash_release(zvrf->vni_table, zvni);
- if (tmp_zvni)
- XFREE(MTYPE_ZVNI, tmp_zvni);
+ XFREE(MTYPE_ZVNI, tmp_zvni);
return 0;
}
@@ -4299,8 +4296,7 @@ static int zl3vni_rmac_del(zebra_l3vni_t *zl3vni, zebra_mac_t *zrmac)
}
tmp_rmac = hash_release(zl3vni->rmac_table, zrmac);
- if (tmp_rmac)
- XFREE(MTYPE_MAC, tmp_rmac);
+ XFREE(MTYPE_MAC, tmp_rmac);
return 0;
}
@@ -4476,8 +4472,7 @@ static int zl3vni_nh_del(zebra_l3vni_t *zl3vni, zebra_neigh_t *n)
}
tmp_n = hash_release(zl3vni->nh_table, n);
- if (tmp_n)
- XFREE(MTYPE_NEIGH, tmp_n);
+ XFREE(MTYPE_NEIGH, tmp_n);
return 0;
}
@@ -4709,8 +4704,7 @@ static int zl3vni_del(zebra_l3vni_t *zl3vni)
/* Free the VNI hash entry and allocated memory. */
tmp_zl3vni = hash_release(zrouter.l3vni_table, zl3vni);
- if (tmp_zl3vni)
- XFREE(MTYPE_ZL3VNI, tmp_zl3vni);
+ XFREE(MTYPE_ZL3VNI, tmp_zl3vni);
return 0;
}