[dpdk-dev] lpm6: set errno on creation error

Message ID 1508851785-54623-1-git-send-email-iryzhov@nfware.com (mailing list archive)
State Accepted, archived
Headers

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK

Commit Message

Igor Ryzhov Oct. 24, 2017, 1:29 p.m. UTC
  Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
---
 lib/librte_lpm/rte_lpm6.c | 3 +++
 1 file changed, 3 insertions(+)
  

Comments

Bruce Richardson Oct. 24, 2017, 2:20 p.m. UTC | #1
On Tue, Oct 24, 2017 at 04:29:45PM +0300, Igor Ryzhov wrote:
> Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
> ---
>  lib/librte_lpm/rte_lpm6.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
  
Thomas Monjalon Oct. 24, 2017, 7:36 p.m. UTC | #2
24/10/2017 16:20, Bruce Richardson:
> On Tue, Oct 24, 2017 at 04:29:45PM +0300, Igor Ryzhov wrote:
> > Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
> > ---
> >  lib/librte_lpm/rte_lpm6.c | 3 +++
> >  1 file changed, 3 insertions(+)
> > 
> Acked-by: Bruce Richardson <bruce.richardson@intel.com>

Applied, thanks
  

Patch

diff --git a/lib/librte_lpm/rte_lpm6.c b/lib/librte_lpm/rte_lpm6.c
index b4a7df3..5ca322c 100644
--- a/lib/librte_lpm/rte_lpm6.c
+++ b/lib/librte_lpm/rte_lpm6.c
@@ -191,6 +191,7 @@  rte_lpm6_create(const char *name, int socket_id,
 	te = rte_zmalloc("LPM6_TAILQ_ENTRY", sizeof(*te), 0);
 	if (te == NULL) {
 		RTE_LOG(ERR, LPM, "Failed to allocate tailq entry!\n");
+		rte_errno = ENOMEM;
 		goto exit;
 	}
 
@@ -201,6 +202,7 @@  rte_lpm6_create(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;
 	}
 
@@ -212,6 +214,7 @@  rte_lpm6_create(const char *name, int socket_id,
 		rte_free(lpm);
 		lpm = NULL;
 		rte_free(te);
+		rte_errno = ENOMEM;
 		goto exit;
 	}