patches for DPDK stable branches
 help / color / mirror / Atom feed
* [dpdk-stable] [PATCH] eal/linux: fix return after alarm registration failure
@ 2019-06-26 10:40 Thomas Monjalon
  2019-06-26 11:20 ` David Marchand
  2019-06-26 14:02 ` [dpdk-stable] [PATCH v2] " Thomas Monjalon
  0 siblings, 2 replies; 5+ messages in thread
From: Thomas Monjalon @ 2019-06-26 10:40 UTC (permalink / raw)
  To: dev; +Cc: david.marchand, stable

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 reset to 0 so the behaviour and the return code
are consistent.
Other return code related lines are cleaned up for easier understanding.

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

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
---
 lib/librte_eal/linux/eal/eal_alarm.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/lib/librte_eal/linux/eal/eal_alarm.c b/lib/librte_eal/linux/eal/eal_alarm.c
index 840ede780..d6d70e8c3 100644
--- a/lib/librte_eal/linux/eal/eal_alarm.c
+++ b/lib/librte_eal/linux/eal/eal_alarm.c
@@ -137,9 +137,13 @@ 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,
+		ret = rte_intr_callback_register(&intr_handle,
 				eal_alarm_callback, NULL);
-		handler_registered = (ret == 0) ? 1 : 0;
+		if (ret == 0)
+			handler_registered = 1;
+		else
+			/* not fatal, callback can be registered later */
+			ret = 0;
 	}
 
 	if (LIST_EMPTY(&alarm_list))
-- 
2.21.0


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2019-06-27 15:25 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-26 10:40 [dpdk-stable] [PATCH] eal/linux: fix return after alarm registration failure Thomas Monjalon
2019-06-26 11:20 ` David Marchand
2019-06-26 14:02 ` [dpdk-stable] [PATCH v2] " Thomas Monjalon
2019-06-26 23:09   ` [dpdk-stable] [dpdk-dev] " Stephen Hemminger
2019-06-27 15:25     ` Thomas Monjalon

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).