From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-177180.vip.163.com (mail-177180.vip.163.com [123.58.177.180]) by dpdk.org (Postfix) with ESMTP id 60FCF235; Fri, 7 Dec 2018 02:20:31 +0100 (CET) Received: from localhost.localdomain (unknown [116.196.72.250]) by smtp1 (Coremail) with SMTP id oGZ4CgAXH7fOyglco1zrAw--.14405S2; Fri, 07 Dec 2018 09:20:29 +0800 (CST) From: Gao Feng To: dev@dpdk.org Cc: anatoly.burakov@intel.com, stable@dpdk.org, Gao Feng Date: Fri, 7 Dec 2018 09:20:08 +0800 Message-Id: <1544145608-828-1-git-send-email-gfree.wind@vip.163.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1544057251-17351-1-git-send-email-gfree.wind@vip.163.com> References: <1544057251-17351-1-git-send-email-gfree.wind@vip.163.com> X-CM-TRANSID: oGZ4CgAXH7fOyglco1zrAw--.14405S2 X-Coremail-Antispam: 1Uf129KBjvJXoW7Ar18tr13uF43GF4rJw15twb_yoW8XrWUpF 9rGF12yr18trs29F9rGa1F934jkFZ3G3W7ArZ7CwsIyrs8A3y0vFyYya43Xry3Wry7XFZ8 ArWrAF1a9r4UCrUanT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x07jj7KxUUUUU= X-Originating-IP: [116.196.72.250] X-CM-SenderInfo: 5jiuvvgozl0vg6yl1hqrwthudrp/1tbiHx0Ws1UH2329MAAAse Subject: [dpdk-dev] [PATCH v2] eal: fix unlock in rte_eal_memzone_init X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 Dec 2018 01:20:32 -0000 The RTE_PROC_PRIMARY error handler lost the unlock statement in the current codes. Now unlock and return in one place to fix it. Fixes: 49df3db84883 ("memzone: replace memzone array with fbarray") Cc: stable@dpdk.org Signed-off-by: Gao Feng --- v2: Unlock and return in one place, per Anatoly lib/librte_eal/common/eal_common_memzone.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/librte_eal/common/eal_common_memzone.c b/lib/librte_eal/common/eal_common_memzone.c index b7081af..664df5b 100644 --- a/lib/librte_eal/common/eal_common_memzone.c +++ b/lib/librte_eal/common/eal_common_memzone.c @@ -365,6 +365,7 @@ int rte_eal_memzone_init(void) { struct rte_mem_config *mcfg; + int ret = 0; /* get pointer to global configuration */ mcfg = rte_eal_get_configuration()->mem_config; @@ -375,17 +376,16 @@ rte_eal_memzone_init(void) rte_fbarray_init(&mcfg->memzones, "memzone", RTE_MAX_MEMZONE, sizeof(struct rte_memzone))) { RTE_LOG(ERR, EAL, "Cannot allocate memzone list\n"); - return -1; + ret = -1; } else if (rte_eal_process_type() == RTE_PROC_SECONDARY && rte_fbarray_attach(&mcfg->memzones)) { RTE_LOG(ERR, EAL, "Cannot attach to memzone list\n"); - rte_rwlock_write_unlock(&mcfg->mlock); - return -1; + ret = -1; } rte_rwlock_write_unlock(&mcfg->mlock); - return 0; + return ret; } /* Walk all reserved memory zones */ -- 2.7.4