From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id AA368A0520; Thu, 2 Jul 2020 13:47:33 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 804AF1D9D1; Thu, 2 Jul 2020 13:47:33 +0200 (CEST) Received: from huawei.com (szxga07-in.huawei.com [45.249.212.35]) by dpdk.org (Postfix) with ESMTP id 88A2A1D97B; Thu, 2 Jul 2020 13:47:31 +0200 (CEST) Received: from DGGEMS409-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id 9A57FCFDA1700481AF5B; Thu, 2 Jul 2020 19:47:30 +0800 (CST) Received: from localhost (10.174.185.168) by DGGEMS409-HUB.china.huawei.com (10.3.19.209) with Microsoft SMTP Server id 14.3.487.0; Thu, 2 Jul 2020 19:47:21 +0800 From: wangyunjian To: CC: , , , Yunjian Wang , Date: Thu, 2 Jul 2020 19:47:19 +0800 Message-ID: <1593690439-26908-1-git-send-email-wangyunjian@huawei.com> X-Mailer: git-send-email 1.9.5.msysgit.1 In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.174.185.168] X-CFilter-Loop: Reflected Subject: [dpdk-dev] [PATCH v3 2/2] eal: return error code when failure 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" From: Yunjian Wang Fix return value, using -EAGAIN instead of 0 when the callback is busy and using -ENOENT instead of 0 when the callback is not found. Fixes: a753e53d517b ("eal: add device event monitor framework") Cc: stable@dpdk.org Signed-off-by: Yunjian Wang Acked-by: Jeff Guo --- lib/librte_eal/common/eal_common_dev.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/librte_eal/common/eal_common_dev.c b/lib/librte_eal/common/eal_common_dev.c index 4cfdb80..f8df8d4 100644 --- a/lib/librte_eal/common/eal_common_dev.c +++ b/lib/librte_eal/common/eal_common_dev.c @@ -531,9 +531,15 @@ static int cmp_dev_name(const struct rte_device *dev, const void *_name) free(event_cb); ret++; } else { - continue; + ret = -EAGAIN; + break; } } + + /* this callback is not be registered */ + if (ret == 0) + ret = -ENOENT; + rte_spinlock_unlock(&dev_event_lock); return ret; } -- 1.8.3.1