DPDK patches and discussions
 help / color / mirror / Atom feed
From: Thomas Monjalon <thomas@monjalon.net>
To: dev@dpdk.org
Cc: david.marchand@redhat.com, stable@dpdk.org
Subject: [dpdk-dev] [PATCH v2] eal/linux: fix return after alarm registration failure
Date: Wed, 26 Jun 2019 16:02:34 +0200	[thread overview]
Message-ID: <20190626140234.12394-1-thomas@monjalon.net> (raw)
In-Reply-To: <20190626104056.26829-1-thomas@monjalon.net>

When adding an alarm, if an error happen when registering
the common alarm callback, it is not considered as a major failure.
The alarm is then inserted in the list.
However it was returning an error code after inserting the alarm.

The error code is not set anymore to be consistent with the behaviour.

Fixes: af75078fece3 ("first public release")
Cc: stable@dpdk.org

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
---
v2: do not use variable ret
---
 lib/librte_eal/linux/eal/eal_alarm.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/lib/librte_eal/linux/eal/eal_alarm.c b/lib/librte_eal/linux/eal/eal_alarm.c
index 840ede780..0924c9205 100644
--- a/lib/librte_eal/linux/eal/eal_alarm.c
+++ b/lib/librte_eal/linux/eal/eal_alarm.c
@@ -137,9 +137,10 @@ rte_eal_alarm_set(uint64_t us, rte_eal_alarm_callback cb_fn, void *cb_arg)
 
 	rte_spinlock_lock(&alarm_list_lk);
 	if (!handler_registered) {
-		ret |= rte_intr_callback_register(&intr_handle,
-				eal_alarm_callback, NULL);
-		handler_registered = (ret == 0) ? 1 : 0;
+		/* registration can fail, callback can be registered later */
+		if (rte_intr_callback_register(&intr_handle,
+				eal_alarm_callback, NULL) == 0)
+			handler_registered = 1;
 	}
 
 	if (LIST_EMPTY(&alarm_list))
-- 
2.21.0


  parent reply	other threads:[~2019-06-26 14:02 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-26 10:40 [dpdk-dev] [PATCH] " Thomas Monjalon
2019-06-26 11:20 ` David Marchand
2019-06-26 11:36   ` Thomas Monjalon
2019-06-26 11:39     ` David Marchand
2019-06-26 11:43       ` Burakov, Anatoly
2019-06-26 11:55         ` Thomas Monjalon
2019-06-26 12:36           ` Bruce Richardson
2019-06-26 12:52             ` Burakov, Anatoly
2019-06-26 13:20               ` Thomas Monjalon
2019-06-26 14:02 ` Thomas Monjalon [this message]
2019-06-26 23:09   ` [dpdk-dev] [PATCH v2] " Stephen Hemminger
2019-06-27 15:25     ` [dpdk-dev] [dpdk-stable] " Thomas Monjalon

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=20190626140234.12394-1-thomas@monjalon.net \
    --to=thomas@monjalon.net \
    --cc=david.marchand@redhat.com \
    --cc=dev@dpdk.org \
    --cc=stable@dpdk.org \
    /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).