From 6636fc44c8ffa72061abaef710e3e773f41c6e4f Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Fri, 5 May 2023 18:57:21 -0400 Subject: [PATCH] zebra: Dplane ctx allocation cannot fail Having tests for memory allocation success makes no sense given what happens when frr fails to allocate memory. Signed-off-by: Donald Sharp --- zebra/zebra_dplane.c | 34 ---------------------------------- 1 file changed, 34 deletions(-) diff --git a/zebra/zebra_dplane.c b/zebra/zebra_dplane.c index f6c1fdd78e..e78cd3b1d0 100644 --- a/zebra/zebra_dplane.c +++ b/zebra/zebra_dplane.c @@ -3785,18 +3785,12 @@ tc_qdisc_update_internal(enum dplane_op_e op, /* Obtain context block */ ctx = dplane_ctx_alloc(); - if (!ctx) { - ret = ENOMEM; - goto done; - } - /* Init context with info from zebra data structs */ ret = dplane_ctx_tc_qdisc_init(ctx, op, qdisc); if (ret == AOK) ret = dplane_update_enqueue(ctx); -done: /* Update counter */ atomic_fetch_add_explicit(&zdplane_info.dg_tcs_in, 1, memory_order_relaxed); @@ -3822,18 +3816,12 @@ tc_class_update_internal(enum dplane_op_e op, struct zebra_tc_class *class) /* Obtain context block */ ctx = dplane_ctx_alloc(); - if (!ctx) { - ret = ENOMEM; - goto done; - } - /* Init context with info from zebra data structs */ ret = dplane_ctx_tc_class_init(ctx, op, class); if (ret == AOK) ret = dplane_update_enqueue(ctx); -done: /* Update counter */ atomic_fetch_add_explicit(&zdplane_info.dg_tcs_in, 1, memory_order_relaxed); @@ -3859,18 +3847,12 @@ tc_filter_update_internal(enum dplane_op_e op, struct zebra_tc_filter *filter) /* Obtain context block */ ctx = dplane_ctx_alloc(); - if (!ctx) { - ret = ENOMEM; - goto done; - } - /* Init context with info from zebra data structs */ ret = dplane_ctx_tc_filter_init(ctx, op, filter); if (ret == AOK) ret = dplane_update_enqueue(ctx); -done: /* Update counter */ atomic_fetch_add_explicit(&zdplane_info.dg_tcs_in, 1, memory_order_relaxed); @@ -3943,16 +3925,11 @@ dplane_nexthop_update_internal(struct nhg_hash_entry *nhe, enum dplane_op_e op) /* Obtain context block */ ctx = dplane_ctx_alloc(); - if (!ctx) { - ret = ENOMEM; - goto done; - } ret = dplane_ctx_nexthop_init(ctx, op, nhe); if (ret == AOK) ret = dplane_update_enqueue(ctx); -done: /* Update counter */ atomic_fetch_add_explicit(&zdplane_info.dg_nexthops_in, 1, memory_order_relaxed); @@ -4083,8 +4060,6 @@ dplane_route_notif_update(struct route_node *rn, goto done; new_ctx = dplane_ctx_alloc(); - if (new_ctx == NULL) - goto done; /* Init context with info from zebra data structs */ dplane_ctx_route_init(new_ctx, op, rn, re); @@ -4216,10 +4191,6 @@ dplane_lsp_notif_update(struct zebra_lsp *lsp, enum dplane_op_e op, /* Obtain context block */ ctx = dplane_ctx_alloc(); - if (ctx == NULL) { - ret = ENOMEM; - goto done; - } /* Copy info from zebra LSP */ ret = dplane_ctx_lsp_init(ctx, op, lsp); @@ -4589,16 +4560,11 @@ dplane_intf_update_internal(const struct interface *ifp, enum dplane_op_e op) /* Obtain context block */ ctx = dplane_ctx_alloc(); - if (!ctx) { - ret = ENOMEM; - goto done; - } ret = dplane_ctx_intf_init(ctx, op, ifp); if (ret == AOK) ret = dplane_update_enqueue(ctx); -done: /* Update counter */ atomic_fetch_add_explicit(&zdplane_info.dg_intfs_in, 1, memory_order_relaxed); -- 2.39.5