@@ -2445,13 +2445,6 @@ ice_get_recp_frm_fw(struct ice_hw *hw, struct ice_sw_recipe *recps, u8 rid,
24452445 lkup_exts -> n_val_words = fv_word_idx ;
24462446 recps [rid ].big_recp = (num_recps > 1 );
24472447 recps [rid ].n_grp_count = (u8 )num_recps ;
2448- recps [rid ].root_buf = devm_kmemdup (ice_hw_to_dev (hw ), tmp ,
2449- recps [rid ].n_grp_count * sizeof (* recps [rid ].root_buf ),
2450- GFP_KERNEL );
2451- if (!recps [rid ].root_buf ) {
2452- status = - ENOMEM ;
2453- goto err_unroll ;
2454- }
24552448
24562449 /* Copy result indexes */
24572450 bitmap_copy (recps [rid ].res_idxs , result_bm , ICE_MAX_FV_WORDS );
@@ -4768,11 +4761,6 @@ ice_find_recp(struct ice_hw *hw, struct ice_prot_lkup_ext *lkup_exts,
47684761 continue ;
47694762 }
47704763
4771- /* Skip inverse action recipes */
4772- if (recp [i ].root_buf && recp [i ].root_buf -> content .act_ctrl &
4773- ICE_AQ_RECIPE_ACT_INV_ACT )
4774- continue ;
4775-
47764764 /* if number of words we are looking for match */
47774765 if (lkup_exts -> n_val_words == recp [i ].lkup_exts .n_val_words ) {
47784766 struct ice_fv_word * ar = recp [i ].lkup_exts .fv_words ;
@@ -5081,9 +5069,9 @@ static int
50815069ice_add_sw_recipe (struct ice_hw * hw , struct ice_sw_recipe * rm ,
50825070 unsigned long * profiles )
50835071{
5072+ struct ice_aqc_recipe_data_elem * buf __free (kfree ) = NULL ;
50845073 DECLARE_BITMAP (result_idx_bm , ICE_MAX_FV_WORDS );
50855074 struct ice_aqc_recipe_content * content ;
5086- struct ice_aqc_recipe_data_elem * buf ;
50875075 struct ice_recp_grp_entry * entry ;
50885076 u16 free_res_idx ;
50895077 u8 chain_idx ;
@@ -5112,12 +5100,9 @@ ice_add_sw_recipe(struct ice_hw *hw, struct ice_sw_recipe *rm,
51125100 if (rm -> n_grp_count > ICE_MAX_CHAIN_RECIPE )
51135101 return - ENOSPC ;
51145102
5115- buf = devm_kcalloc (ice_hw_to_dev (hw ), rm -> n_grp_count , sizeof (* buf ),
5116- GFP_KERNEL );
5117- if (!buf ) {
5118- status = - ENOMEM ;
5119- goto err_mem ;
5120- }
5103+ buf = kcalloc (rm -> n_grp_count , sizeof (* buf ), GFP_KERNEL );
5104+ if (!buf )
5105+ return - ENOMEM ;
51215106
51225107 bitmap_zero (rm -> r_bitmap , ICE_MAX_NUM_RECIPES );
51235108
@@ -5130,7 +5115,7 @@ ice_add_sw_recipe(struct ice_hw *hw, struct ice_sw_recipe *rm,
51305115
51315116 status = ice_alloc_recipe (hw , & entry -> rid );
51325117 if (status )
5133- goto err_unroll ;
5118+ return status ;
51345119
51355120 content = & buf [recps ].content ;
51365121
@@ -5160,8 +5145,7 @@ ice_add_sw_recipe(struct ice_hw *hw, struct ice_sw_recipe *rm,
51605145 */
51615146 if (chain_idx >= ICE_MAX_FV_WORDS ) {
51625147 ice_debug (hw , ICE_DBG_SW , "No chain index available\n" );
5163- status = - ENOSPC ;
5164- goto err_unroll ;
5148+ return - ENOSPC ;
51655149 }
51665150
51675151 entry -> chain_idx = chain_idx ;
@@ -5215,7 +5199,7 @@ ice_add_sw_recipe(struct ice_hw *hw, struct ice_sw_recipe *rm,
52155199 */
52165200 status = ice_alloc_recipe (hw , & rid );
52175201 if (status )
5218- goto err_unroll ;
5202+ return status ;
52195203
52205204 content = & buf [recps ].content ;
52215205
@@ -5228,10 +5212,9 @@ ice_add_sw_recipe(struct ice_hw *hw, struct ice_sw_recipe *rm,
52285212 last_chain_entry = devm_kzalloc (ice_hw_to_dev (hw ),
52295213 sizeof (* last_chain_entry ),
52305214 GFP_KERNEL );
5231- if (!last_chain_entry ) {
5232- status = - ENOMEM ;
5233- goto err_unroll ;
5234- }
5215+ if (!last_chain_entry )
5216+ return - ENOMEM ;
5217+
52355218 last_chain_entry -> rid = rid ;
52365219 memset (& content -> lkup_indx , 0 , sizeof (content -> lkup_indx ));
52375220 /* All recipes use look-up index 0 to match switch ID. */
@@ -5265,12 +5248,12 @@ ice_add_sw_recipe(struct ice_hw *hw, struct ice_sw_recipe *rm,
52655248 }
52665249 status = ice_acquire_change_lock (hw , ICE_RES_WRITE );
52675250 if (status )
5268- goto err_unroll ;
5251+ return status ;
52695252
52705253 status = ice_aq_add_recipe (hw , buf , rm -> n_grp_count , NULL );
52715254 ice_release_change_lock (hw );
52725255 if (status )
5273- goto err_unroll ;
5256+ return status ;
52745257
52755258 /* Every recipe that just got created add it to the recipe
52765259 * book keeping list
@@ -5288,10 +5271,8 @@ ice_add_sw_recipe(struct ice_hw *hw, struct ice_sw_recipe *rm,
52885271 idx_found = true;
52895272 }
52905273
5291- if (!idx_found ) {
5292- status = - EIO ;
5293- goto err_unroll ;
5294- }
5274+ if (!idx_found )
5275+ return - EIO ;
52955276
52965277 recp = & sw -> recp_list [entry -> rid ];
52975278 is_root = (rm -> root_rid == entry -> rid );
@@ -5327,13 +5308,8 @@ ice_add_sw_recipe(struct ice_hw *hw, struct ice_sw_recipe *rm,
53275308 recp -> allow_pass_l2 = rm -> allow_pass_l2 ;
53285309 recp -> recp_created = true;
53295310 }
5330- rm -> root_buf = buf ;
5331- return status ;
53325311
5333- err_unroll :
5334- err_mem :
5335- devm_kfree (ice_hw_to_dev (hw ), buf );
5336- return status ;
5312+ return 0 ;
53375313}
53385314
53395315/**
@@ -5632,7 +5608,6 @@ ice_add_adv_recipe(struct ice_hw *hw, struct ice_adv_lkup_elem *lkups,
56325608 devm_kfree (ice_hw_to_dev (hw ), fvit );
56335609 }
56345610
5635- devm_kfree (ice_hw_to_dev (hw ), rm -> root_buf );
56365611 kfree (rm );
56375612
56385613err_free_lkup_exts :
0 commit comments