[v2,06/25] net/bnxt: free the EM index on failure
diff mbox series

Message ID 20200916042851.32914-7-ajit.khaparde@broadcom.com
State Accepted, archived
Delegated to: Ajit Khaparde
Headers show
  • patchset for bnxt
Related show


Context Check Description
ci/checkpatch success coding style OK

Commit Message

Ajit Khaparde Sept. 16, 2020, 4:28 a.m. UTC
From: Mike Baucom <michael.baucom@broadcom.com>

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 | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff mbox series

diff --git a/drivers/net/bnxt/tf_core/tf_em_internal.c b/drivers/net/bnxt/tf_core/tf_em_internal.c
index 462d0fa76..c95515b1b 100644
--- a/drivers/net/bnxt/tf_core/tf_em_internal.c
+++ b/drivers/net/bnxt/tf_core/tf_em_internal.c
@@ -175,8 +175,11 @@  tf_em_insert_int_entry(struct tf *tfp,
-	if (rc)
+	if (rc) {
+		/* Free the allocated index before returning */
+		stack_push(pool, index);
 		return -1;
+	}