From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from dpdk.org (dpdk.org [92.243.14.124])
	by inbox.dpdk.org (Postfix) with ESMTP id 297B8A046B
	for <public@inbox.dpdk.org>; Wed, 26 Jun 2019 16:02:49 +0200 (CEST)
Received: from [92.243.14.124] (localhost [127.0.0.1])
	by dpdk.org (Postfix) with ESMTP id 7811AF64;
	Wed, 26 Jun 2019 16:02:47 +0200 (CEST)
Received: from out3-smtp.messagingengine.com (out3-smtp.messagingengine.com
 [66.111.4.27]) by dpdk.org (Postfix) with ESMTP id 4443123D;
 Wed, 26 Jun 2019 16:02:46 +0200 (CEST)
Received: from compute1.internal (compute1.nyi.internal [10.202.2.41])
 by mailout.nyi.internal (Postfix) with ESMTP id 924A421F14;
 Wed, 26 Jun 2019 10:02:45 -0400 (EDT)
Received: from mailfrontend2 ([10.202.2.163])
 by compute1.internal (MEProxy); Wed, 26 Jun 2019 10:02:45 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monjalon.net; h=
 from:to:cc:subject:date:message-id:in-reply-to:references
 :mime-version:content-transfer-encoding; s=mesmtp; bh=fVyIkPcr9d
 cOlhLhIZrq4Fs2NQhYkptqc/5mvqZbwfM=; b=QefNrkM+e3Pr82lsbkA7H7aI48
 DiNw7pvnB77IkYURCywY4xnhGY+C3i1dX8OIxUWZ258zdR6CbpIUH+UVEnscYi8y
 JxA3GGElmpN5n4WczLJhxZsK4gP9AnmXilETt2wDIk1/2tf7ah+VTnjAjww/hHSY
 RKLBX2wa0IRkkzisY=
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=
 messagingengine.com; h=cc:content-transfer-encoding:date:from
 :in-reply-to:message-id:mime-version:references:subject:to
 :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=
 fm3; bh=fVyIkPcr9dcOlhLhIZrq4Fs2NQhYkptqc/5mvqZbwfM=; b=WvvS7UN4
 Uf7lJYM5zskPJeuvmWEJegNe7IGt1ldCK+ETlk4NI+dwtHFnAdLhDvjWvhM7K5Ti
 nvASr6TkeAUawBt2CL+JnpX6kkIdmaopJV6bS8LbOBOOKKXwVEEAWOdzijIOYPHV
 /TFiyjl5UYSWZ0x+0U0iiivKlxKsKNLV+nwnNuB0/F9Uf2K/iyAdwPJp46uZpQ3u
 hj4sUjq9TnQwDrzjFm/AVSCZhTwodE6jFaWU+22Bab+hRgs51zjbdHGcFA493jkE
 SoZFLvlrqZM1bDDe+vUQZYdK12L3U0YL3olHoYds3Tz1ZoUj5E5g2RErBKWhposM
 Y8Ka6RjUxxVNzg==
X-ME-Sender: <xms:BHsTXdAyh3c9XHGlQIF9ku1JLsiNVpuakap4dLOFDNMxaYTd2ZZ7FQ>
X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduvddrudeigdejfecutefuodetggdotefrodftvf
 curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu
 uegrihhlohhuthemuceftddtnecunecujfgurhephffvufffkffojghfggfgsedtkeertd
 ertddtnecuhfhrohhmpefvhhhomhgrshcuofhonhhjrghlohhnuceothhhohhmrghssehm
 ohhnjhgrlhhonhdrnhgvtheqnecukfhppeejjedrudefgedrvddtfedrudekgeenucfrrg
 hrrghmpehmrghilhhfrhhomhepthhhohhmrghssehmohhnjhgrlhhonhdrnhgvthenucev
 lhhushhtvghrufhiiigvpedt
X-ME-Proxy: <xmx:BXsTXeMLFDvpJWWHJXNx3G6NmTLJIe1ubumNDnzftnxE-7mdVa5HsQ>
 <xmx:BXsTXUblnixqjhyyP_ilmj8IuzyLS7V9-4ch2u9NJfRIrg__05JigQ>
 <xmx:BXsTXeOO8yOl10JaeF89D2mGnNMqKz9iXA7rjVLJUhBKkzDIejqKnQ>
 <xmx:BXsTXZYbG-kYu-Mz0QGi2Ag6ReiqS3O8OujMAp6twYeqkqigcmtcng>
Received: from xps.monjalon.net (184.203.134.77.rev.sfr.net [77.134.203.184])
 by mail.messagingengine.com (Postfix) with ESMTPA id 48BA4380075;
 Wed, 26 Jun 2019 10:02:44 -0400 (EDT)
From: Thomas Monjalon <thomas@monjalon.net>
To: dev@dpdk.org
Cc: david.marchand@redhat.com,
	stable@dpdk.org
Date: Wed, 26 Jun 2019 16:02:34 +0200
Message-Id: <20190626140234.12394-1-thomas@monjalon.net>
X-Mailer: git-send-email 2.21.0
In-Reply-To: <20190626104056.26829-1-thomas@monjalon.net>
References: <20190626104056.26829-1-thomas@monjalon.net>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Subject: [dpdk-dev] [PATCH v2] eal/linux: fix return after alarm
	registration failure
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org
Sender: "dev" <dev-bounces@dpdk.org>

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