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 1EB0DA0524; Thu, 2 Jul 2020 11:18:54 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id EC4CA1D6E3; Thu, 2 Jul 2020 11:18:53 +0200 (CEST) Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by dpdk.org (Postfix) with ESMTP id 9087C1D626; Thu, 2 Jul 2020 11:18:52 +0200 (CEST) IronPort-SDR: WXU3lmEBCv8tZjmZvPthTmbXat6HW9uS+TZ+7t/NfkU8iYjy7FqIkP7mWEhL+x85BzKrAnazm0 pfgdJoidoORg== X-IronPort-AV: E=McAfee;i="6000,8403,9669"; a="126456765" X-IronPort-AV: E=Sophos;i="5.75,303,1589266800"; d="scan'208";a="126456765" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Jul 2020 02:18:51 -0700 IronPort-SDR: 53pXq4QG3u3yAWO03h5WpKREaKD5Jjms1PMWjYaPTDf5TNz3ycpIt+SPImakcEaHZlRr4x8JYh xmyc/DDrHEKw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.75,303,1589266800"; d="scan'208";a="455457759" Received: from jguo15x-mobl.ccr.corp.intel.com (HELO [10.67.68.176]) ([10.67.68.176]) by orsmga005.jf.intel.com with ESMTP; 02 Jul 2020 02:18:48 -0700 To: wangyunjian , dev@dpdk.org Cc: jerry.lilijun@huawei.com, xudingke@huawei.com, stable@dpdk.org References: <65433c2a9efdb47b1c9dba63d9bd1cb160e08097.1591186247.git.wangyunjian@huawei.com> From: Jeff Guo Message-ID: <058d3d03-ccd4-f8f1-c489-5b6525867516@intel.com> Date: Thu, 2 Jul 2020 17:18:47 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.9.0 MIME-Version: 1.0 In-Reply-To: <65433c2a9efdb47b1c9dba63d9bd1cb160e08097.1591186247.git.wangyunjian@huawei.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US Subject: Re: [dpdk-dev] [PATCH 3/3] 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" hi, yunjian On 6/3/2020 8:55 PM, wangyunjian wrote: > 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 > --- > lib/librte_eal/common/eal_common_dev.c | 7 ++++++- > 1 file changed, 6 insertions(+), 1 deletion(-) > > diff --git a/lib/librte_eal/common/eal_common_dev.c b/lib/librte_eal/common/eal_common_dev.c > index 6b465bc..5f5e333 100644 > --- a/lib/librte_eal/common/eal_common_dev.c > +++ b/lib/librte_eal/common/eal_common_dev.c > @@ -536,9 +536,14 @@ static int cmp_dev_name(const struct rte_device *dev, const void *_name) > free(event_cb); > ret++; > } else { > - continue; > + ret = -EAGAIN; > + break; > } > } Suggest add a blank line here if there will be another version. > + /* this callback is not be registered */ > + if (ret == 0) > + ret = -ENOENT; > + > rte_spinlock_unlock(&dev_event_lock); > return ret; > } Look good and thanks. Acked-by: Jeff Guo