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 B3FB6A0613 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 830501E2F; Wed, 26 Jun 2019 13:20:29 +0200 (CEST) Received: from mail-vs1-f67.google.com (mail-vs1-f67.google.com [209.85.217.67]) by dpdk.org (Postfix) with ESMTP id A10D8DED for ; Wed, 26 Jun 2019 13:20:28 +0200 (CEST) Received: by mail-vs1-f67.google.com with SMTP id j26so1296547vsn.10 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=Pi0UXpwtrFbkWmlkIxkWH1l1STVAdoWV5N5K3tohhC9tVL+Pj1Ak7LY6Bvbq3MPQ6j 2Ev7yNMoIgbu73jzxRDjjH3pm1JTLEZj+mlfdE2CRnY4WGyvs2CqhJx8zRPO80XUQMgI FHCpwrPdblUcgi4SaFCWKI0Vunpt9WI1t3qW8jo9pcMMBEvG9TRwA+OzDI9r3xRLvKqS sDDxdJKhtnEt8DxB//J8wdY4EWs9d/5QEiFp6dv+BrJ8FvKNe+ynQw079MYJO01tB/Si 678md/rAaHXiGLtNdqKw7Apwx+XeaTXOELGDPw9ZTZRBlWu+V9gWfYVO6V11Pj+iFLpb WD9Q== X-Gm-Message-State: APjAAAWinLtWWlELgUd8jwwFAKn+BWUz9+TKAkpvgR0QnJ35F7Q98vMZ 2a4mBuDuAiAfLgKy/cq+aWQZF/hL/p+ndbLC3MoPwg== 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-dev] [PATCH] 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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