From: Igor Ryzhov <iryzhov@nfware.com>
To: dev@dpdk.org
Subject: [dpdk-dev] [PATCH] lpm: set errno on creation error
Date: Tue, 24 Oct 2017 16:28:30 +0300 [thread overview]
Message-ID: <1508851710-54504-1-git-send-email-iryzhov@nfware.com> (raw)
Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
---
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
next reply other threads:[~2017-10-24 13:28 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-24 13:28 Igor Ryzhov [this message]
2017-10-24 14:20 ` Bruce Richardson
2017-10-24 19:36 ` Thomas Monjalon
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1508851710-54504-1-git-send-email-iryzhov@nfware.com \
--to=iryzhov@nfware.com \
--cc=dev@dpdk.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).