summaryrefslogtreecommitdiff
path: root/lib/librte_lpm
diff options
context:
space:
mode:
authorPavan Nikhilesh <pbhagavatula@caviumnetworks.com>2018-01-31 00:21:54 +0530
committerThomas Monjalon <thomas@monjalon.net>2018-02-01 00:35:06 +0100
commitfc29c712dd6758877bb10166d9a7866ee1fa6875 (patch)
tree87208db5dd2a366f525d82aed8dbde4d1e1a7084 /lib/librte_lpm
parent963898f0e316611df9dc2964d059b4e16835b95a (diff)
downloaddpdk-next-eventdev-fc29c712dd6758877bb10166d9a7866ee1fa6875.zip
dpdk-next-eventdev-fc29c712dd6758877bb10166d9a7866ee1fa6875.tar.gz
dpdk-next-eventdev-fc29c712dd6758877bb10166d9a7866ee1fa6875.tar.xz
lpm: fix allocation of an existing object
Fix rte_lpm_create_*() functions to return NULL and set rte_errno to EEXIST when lpm object name already exists. This is the behavior described in the API documentation in the header file. Fixes: 134975073af3 ("lib: remove unnecessary pointer cast") Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com> Acked-by: Phil Yang <phil.yang@arm.com> Reviewed-by: Anatoly Burakov <anatoly.burakov@intel.com> Acked-by: Ferruh Yigit <ferruh.yigit@intel.com>
Diffstat (limited to 'lib/librte_lpm')
-rw-r--r--lib/librte_lpm/rte_lpm.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/librte_lpm/rte_lpm.c b/lib/librte_lpm/rte_lpm.c
index d464dbd..d00b13d 100644
--- a/lib/librte_lpm/rte_lpm.c
+++ b/lib/librte_lpm/rte_lpm.c
@@ -180,6 +180,7 @@ rte_lpm_create_v20(const char *name, int socket_id, int max_rules,
}
if (te != NULL) {
+ lpm = NULL;
rte_errno = EEXIST;
goto exit;
}
@@ -256,6 +257,7 @@ rte_lpm_create_v1604(const char *name, int socket_id,
}
if (te != NULL) {
+ lpm = NULL;
rte_errno = EEXIST;
goto exit;
}