From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id 87323A046B for ; Wed, 26 Jun 2019 12:41:04 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 671422B99; Wed, 26 Jun 2019 12:41:04 +0200 (CEST) Received: from out1-smtp.messagingengine.com (out1-smtp.messagingengine.com [66.111.4.25]) by dpdk.org (Postfix) with ESMTP id 10708F64; Wed, 26 Jun 2019 12:41:01 +0200 (CEST) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id A985A21165; Wed, 26 Jun 2019 06:41:00 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute1.internal (MEProxy); Wed, 26 Jun 2019 06:41:00 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monjalon.net; h= from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; s=mesmtp; bh=2X7swVLBlHPY6E58fpAb5al oGq9zqaSBLdf69JwrK9g=; b=PRs2L+EX35LZBSAcKMiNrPY+iP9hAoHWzHS62k6 QF0DigKJHsmaCm3Gn21A85zroLjD9tY11TrUAPEm4cxcLECSwmuGeOW30bK4I9oM GGwe876yysZm7uTA6rfHd1aP3BmY59p13nKz9NthfBPyXNL7fHJQmApQXeqEce4I 51yY= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :message-id:mime-version:subject:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; bh=2X7swVLBlHPY6E58f pAb5aloGq9zqaSBLdf69JwrK9g=; b=GQ37OBSHBbV3MYPzouONSL+vR2ICGd+Jd CsQjbUckOS1bvFqmtpFO/yBK/3Pw2Dyp3+xpuppv3rxyy5+Af/XFNpfu/+nENnSL 6SP7jGqx1Li7566agaxAcHPnmSOwxxYIW6t4X2zuRLQlDbNvL+FMi8bfD6GK9QrQ gDhnlZnQg70FL4cuUJl6lR9vq5d0DpkvXtHdWoPwEfV4WNVSVM7C8vbhJwBQzzf5 BrBfYjaoqfy9Lx6I2RAQ304xxvgRX47aEDA6c1AJ+pCtNrW6HQfFaSH1SyopM/dP 5bTTXld30cmAeSLGcoP22XcGETIIgqjVwA6RE2vdsBJGKTSOBZgMg== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduvddrudeigdeffecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecunecujfgurhephffvufffkffoggfgsedtkeertdertd dtnecuhfhrohhmpefvhhhomhgrshcuofhonhhjrghlohhnuceothhhohhmrghssehmohhn jhgrlhhonhdrnhgvtheqnecukfhppeejjedrudefgedrvddtfedrudekgeenucfrrghrrg hmpehmrghilhhfrhhomhepthhhohhmrghssehmohhnjhgrlhhonhdrnhgvthenucevlhhu shhtvghrufhiiigvpedt X-ME-Proxy: Received: from xps.monjalon.net (184.203.134.77.rev.sfr.net [77.134.203.184]) by mail.messagingengine.com (Postfix) with ESMTPA id A9C78380085; Wed, 26 Jun 2019 06:40:59 -0400 (EDT) From: Thomas Monjalon To: dev@dpdk.org Cc: david.marchand@redhat.com, stable@dpdk.org Date: Wed, 26 Jun 2019 12:40:56 +0200 Message-Id: <20190626104056.26829-1-thomas@monjalon.net> X-Mailer: git-send-email 2.21.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-stable] [PATCH] eal/linux: fix return after alarm registration failure X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "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 --- 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