@@ -6368,9 +6368,16 @@ static void hns_roce_v2_int_mask_enable(struct hns_roce_dev *hr_dev,
63686368 roce_write (hr_dev , ROCEE_VF_ABN_INT_CFG_REG , enable_flag );
63696369}
63706370
6371- static void hns_roce_v2_destroy_eqc (struct hns_roce_dev * hr_dev , u32 eqn )
6371+ static void free_eq_buf (struct hns_roce_dev * hr_dev , struct hns_roce_eq * eq )
6372+ {
6373+ hns_roce_mtr_destroy (hr_dev , & eq -> mtr );
6374+ }
6375+
6376+ static void hns_roce_v2_destroy_eqc (struct hns_roce_dev * hr_dev ,
6377+ struct hns_roce_eq * eq )
63726378{
63736379 struct device * dev = hr_dev -> dev ;
6380+ int eqn = eq -> eqn ;
63746381 int ret ;
63756382 u8 cmd ;
63766383
@@ -6381,12 +6388,9 @@ static void hns_roce_v2_destroy_eqc(struct hns_roce_dev *hr_dev, u32 eqn)
63816388
63826389 ret = hns_roce_destroy_hw_ctx (hr_dev , cmd , eqn & HNS_ROCE_V2_EQN_M );
63836390 if (ret )
6384- dev_err (dev , "[mailbox cmd] destroy eqc(%u) failed.\n" , eqn );
6385- }
6391+ dev_err (dev , "[mailbox cmd] destroy eqc(%d) failed.\n" , eqn );
63866392
6387- static void free_eq_buf (struct hns_roce_dev * hr_dev , struct hns_roce_eq * eq )
6388- {
6389- hns_roce_mtr_destroy (hr_dev , & eq -> mtr );
6393+ free_eq_buf (hr_dev , eq );
63906394}
63916395
63926396static void init_eq_config (struct hns_roce_dev * hr_dev , struct hns_roce_eq * eq )
@@ -6733,7 +6737,7 @@ static int hns_roce_v2_init_eq_table(struct hns_roce_dev *hr_dev)
67336737
67346738err_create_eq_fail :
67356739 for (i -= 1 ; i >= 0 ; i -- )
6736- free_eq_buf (hr_dev , & eq_table -> eq [i ]);
6740+ hns_roce_v2_destroy_eqc (hr_dev , & eq_table -> eq [i ]);
67376741 kfree (eq_table -> eq );
67386742
67396743 return ret ;
@@ -6753,11 +6757,8 @@ static void hns_roce_v2_cleanup_eq_table(struct hns_roce_dev *hr_dev)
67536757 __hns_roce_free_irq (hr_dev );
67546758 destroy_workqueue (hr_dev -> irq_workq );
67556759
6756- for (i = 0 ; i < eq_num ; i ++ ) {
6757- hns_roce_v2_destroy_eqc (hr_dev , i );
6758-
6759- free_eq_buf (hr_dev , & eq_table -> eq [i ]);
6760- }
6760+ for (i = 0 ; i < eq_num ; i ++ )
6761+ hns_roce_v2_destroy_eqc (hr_dev , & eq_table -> eq [i ]);
67616762
67626763 kfree (eq_table -> eq );
67636764}
0 commit comments