From mboxrd@z Thu Jan 1 00:00:00 1970 From: Igor Ryzhov Subject: [PATCH] lpm: set errno on creation error Date: Tue, 24 Oct 2017 16:28:30 +0300 Message-ID: <1508851710-54504-1-git-send-email-iryzhov@nfware.com> To: dev@dpdk.org Return-path: Received: from mail-lf0-f68.google.com (mail-lf0-f68.google.com [209.85.215.68]) by dpdk.org (Postfix) with ESMTP id 306381B7FD for ; Tue, 24 Oct 2017 15:28:38 +0200 (CEST) Received: by mail-lf0-f68.google.com with SMTP id w21so24048450lfc.6 for ; Tue, 24 Oct 2017 06:28:38 -0700 (PDT) Received: from localhost.localdomain ([195.34.30.205]) by smtp.gmail.com with ESMTPSA id f21sm77367lja.25.2017.10.24.06.28.36 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 24 Oct 2017 06:28:36 -0700 (PDT) List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Signed-off-by: Igor Ryzhov --- lib/librte_lpm/rte_lpm.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/librte_lpm/rte_lpm.c b/lib/librte_lpm/rte_lpm.c index 64c074e..140dbb2 100644 --- a/lib/librte_lpm/rte_lpm.c +++ b/lib/librte_lpm/rte_lpm.c @@ -218,6 +218,7 @@ rte_lpm_create_v20(const char *name, int socket_id, int max_rules, te = rte_zmalloc("LPM_TAILQ_ENTRY", sizeof(*te), 0); if (te == NULL) { RTE_LOG(ERR, LPM, "Failed to allocate tailq entry\n"); + rte_errno = ENOMEM; goto exit; } @@ -227,6 +228,7 @@ rte_lpm_create_v20(const char *name, int socket_id, int max_rules, if (lpm == NULL) { RTE_LOG(ERR, LPM, "LPM memory allocation failed\n"); rte_free(te); + rte_errno = ENOMEM; goto exit; } @@ -292,6 +294,7 @@ rte_lpm_create_v1604(const char *name, int socket_id, te = rte_zmalloc("LPM_TAILQ_ENTRY", sizeof(*te), 0); if (te == NULL) { RTE_LOG(ERR, LPM, "Failed to allocate tailq entry\n"); + rte_errno = ENOMEM; goto exit; } @@ -301,6 +304,7 @@ rte_lpm_create_v1604(const char *name, int socket_id, if (lpm == NULL) { RTE_LOG(ERR, LPM, "LPM memory allocation failed\n"); rte_free(te); + rte_errno = ENOMEM; goto exit; } @@ -312,6 +316,7 @@ rte_lpm_create_v1604(const char *name, int socket_id, rte_free(lpm); lpm = NULL; rte_free(te); + rte_errno = ENOMEM; goto exit; } @@ -324,6 +329,7 @@ rte_lpm_create_v1604(const char *name, int socket_id, rte_free(lpm); lpm = NULL; rte_free(te); + rte_errno = ENOMEM; goto exit; } -- 2.6.4