From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 5F887A046B for ; Wed, 26 Jun 2019 13:20:29 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 4A668DED; Wed, 26 Jun 2019 13:20:29 +0200 (CEST) Received: from mail-vs1-f65.google.com (mail-vs1-f65.google.com [209.85.217.65]) by dpdk.org (Postfix) with ESMTP id A3D95F64 for ; Wed, 26 Jun 2019 13:20:28 +0200 (CEST) Received: by mail-vs1-f65.google.com with SMTP id u3so1314019vsh.6 for ; Wed, 26 Jun 2019 04:20:28 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=GOmaUKri0gejQKetLti3itO4MapfpJPHONRRH7xdSFQ=; b=m+xIKSsRbUv20LTSY/AJmrJko9k89yDM/pX3tmJdZcB7dVhFwTA896aBJ6RKmc6JHr VhDFnHEFHB1YwCnmnpxK/H7B1ezbKRxF1ehM8aeuXX1Up01R9nU/DdkGwVG5lejJWZ8F /dyigrdcX60QPhC55CHXhOrC8IeAvLW7dz13Yofrzp36AGf8/uCX++k/nn29m4fdeufj HeRJyIujNRzoQtrlC631VVNJtqdm2KyI7z57HlSo5w6AieflDW4msZQM4vr9/vQzw/gI +noJ0kS8PT9Bjo7zi8tTkr3VENwuJX7QTSHcmxfoMceQImScUO1domWNhhhrXSOds/ZU 63kA== X-Gm-Message-State: APjAAAXHYFtRv4yhMzLCoLcyHHFmfejM3Yq7Ss+C/1lxdw5yAZtH652Y 9hmj8MHIMagyWYr95dAKuVCRunCmmYjREFNfXQID4ek6hMk= X-Google-Smtp-Source: APXvYqwe/nb7KtiVOkDxw+Yau9ijxsjts6ynieHemBSz3UsCrohifGTiYPESDpnMxx1+UscchrrHKISiZ6SRGdqzK9U= X-Received: by 2002:a67:2ec8:: with SMTP id u191mr2578944vsu.39.1561548028001; Wed, 26 Jun 2019 04:20:28 -0700 (PDT) MIME-Version: 1.0 References: <20190626104056.26829-1-thomas@monjalon.net> In-Reply-To: <20190626104056.26829-1-thomas@monjalon.net> From: David Marchand Date: Wed, 26 Jun 2019 13:20:17 +0200 Message-ID: To: Thomas Monjalon Cc: dev , dpdk stable Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.15 Subject: Re: [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" On Wed, Jun 26, 2019 at 12:41 PM Thomas Monjalon 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 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)) > Well, then it means that you don't want to touch ret at all. How about: if (rte_intr_callback_register(&intr_handle, eal_alarm_callback, NULL) == 0) handler_registered = 1; ? -- David Marchand