net/bnxt: free EM index on failure
authorMike Baucom <michael.baucom@broadcom.com>
Fri, 11 Sep 2020 01:55:44 +0000 (18:55 -0700)
committerFerruh Yigit <ferruh.yigit@intel.com>
Fri, 18 Sep 2020 16:55:11 +0000 (18:55 +0200)
When a Exact Match entry fails insertion, the allocated index needs to
be pushed back to the allocation stack. This patch takes care of that.

Signed-off-by: Mike Baucom <michael.baucom@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
drivers/net/bnxt/tf_core/tf_em_internal.c

index 462d0fa..c95515b 100644 (file)
@@ -175,8 +175,11 @@ tf_em_insert_int_entry(struct tf *tfp,
                                             &rptr_index,
                                             &rptr_entry,
                                             &num_of_entries);
-       if (rc)
+       if (rc) {
+               /* Free the allocated index before returning */
+               stack_push(pool, index);
                return -1;
+       }
 
        PMD_DRV_LOG
                  (DEBUG,