patches for DPDK stable branches
 help / color / mirror / Atom feed
From: wangyunjian <wangyunjian@huawei.com>
To: <dev@dpdk.org>
Cc: <david.marchand@redhat.com>, <jia.guo@intel.com>,
	<jerinj@marvell.com>, <jerry.lilijun@huawei.com>,
	<xudingke@huawei.com>, Yunjian Wang <wangyunjian@huawei.com>,
	<stable@dpdk.org>
Subject: [dpdk-stable] [dpdk-dev] [PATCH v5 3/3] eal: fix a wrong returned value when callback exists
Date: Wed, 21 Oct 2020 19:19:49 +0800	[thread overview]
Message-ID: <7ec6b12bf0f9fcdb2306dec72390a853abdf2f56.1603207676.git.wangyunjian@huawei.com> (raw)
In-Reply-To: <cover.1603207676.git.wangyunjian@huawei.com>

From: Yunjian Wang <wangyunjian@huawei.com>

We should return an error value, when the callback is already exist.

Fixes: a753e53d517b ("eal: add device event monitor framework")
Cc: stable@dpdk.org

Signed-off-by: Yunjian Wang <wangyunjian@huawei.com>
Suggested-by: David Marchand <david.marchand@6wind.com>
---
 lib/librte_eal/common/eal_common_dev.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/lib/librte_eal/common/eal_common_dev.c b/lib/librte_eal/common/eal_common_dev.c
index d990bfd20d..8a3bd3100a 100644
--- a/lib/librte_eal/common/eal_common_dev.c
+++ b/lib/librte_eal/common/eal_common_dev.c
@@ -480,7 +480,9 @@ rte_dev_event_callback_register(const char *device_name,
 		RTE_LOG(ERR, EAL,
 			"The callback is already exist, no need "
 			"to register again.\n");
+		event_cb = NULL;
 		ret = -EEXIST;
+		goto error;
 	}
 
 	rte_spinlock_unlock(&dev_event_lock);
-- 
2.23.0


  parent reply	other threads:[~2020-10-21 11:20 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <cover.1603207676.git.wangyunjian@huawei.com>
2020-10-21 11:19 ` [dpdk-stable] [dpdk-dev] [PATCH v5 1/3] eal: fix memory leak when removing event_cb wangyunjian
2020-10-21 11:19 ` [dpdk-stable] [dpdk-dev] [PATCH v5 2/3] eal: return error code when failure wangyunjian
2020-10-22 12:51   ` David Marchand
2020-10-23  9:05     ` wangyunjian
2020-10-21 11:19 ` wangyunjian [this message]
2020-10-22 12:55   ` [dpdk-stable] [dpdk-dev] [PATCH v5 3/3] eal: fix a wrong returned value when callback exists David Marchand
2020-10-23  9:05     ` wangyunjian

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7ec6b12bf0f9fcdb2306dec72390a853abdf2f56.1603207676.git.wangyunjian@huawei.com \
    --to=wangyunjian@huawei.com \
    --cc=david.marchand@redhat.com \
    --cc=dev@dpdk.org \
    --cc=jerinj@marvell.com \
    --cc=jerry.lilijun@huawei.com \
    --cc=jia.guo@intel.com \
    --cc=stable@dpdk.org \
    --cc=xudingke@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).