[v2] eal/linux: fix return after alarm registration failure

Message ID 20190626140234.12394-1-thomas@monjalon.net (mailing list archive)
State Accepted, archived
Delegated to: Thomas Monjalon
Headers
Series [v2] eal/linux: fix return after alarm registration failure |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/intel-Performance-Testing success Performance Testing PASS
ci/mellanox-Performance-Testing success Performance Testing PASS
ci/Intel-compilation fail apply issues

Commit Message

Thomas Monjalon June 26, 2019, 2:02 p.m. UTC
  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(-)
  

Comments

Stephen Hemminger June 26, 2019, 11:09 p.m. UTC | #1
On Wed, 26 Jun 2019 16:02:34 +0200
Thomas Monjalon <thomas@monjalon.net> wrote:

> 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

Acked-by: Stephen Hemminger <stephen@networkplumber.org>
  
Thomas Monjalon June 27, 2019, 3:25 p.m. UTC | #2
27/06/2019 01:09, Stephen Hemminger:
> On Wed, 26 Jun 2019 16:02:34 +0200
> Thomas Monjalon <thomas@monjalon.net> wrote:
> 
> > 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
> 
> Acked-by: Stephen Hemminger <stephen@networkplumber.org>

Applied
  

Patch

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