From mboxrd@z Thu Jan 1 00:00:00 1970 From: Thomas Monjalon Subject: Re: [PATCH v6 20/26] eal_pci: continue probing even on failures Date: Wed, 08 Mar 2017 23:04:01 +0100 Message-ID: <17738287.G52ncJujDH@xps13> References: <20170227161811.12309-1-aconole@redhat.com> <20170228185315.12546-1-aconole@redhat.com> <20170228185315.12546-21-aconole@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7Bit Cc: dev@dpdk.org, Stephen Hemminger , Bruce Richardson To: Aaron Conole Return-path: Received: from mail-wm0-f43.google.com (mail-wm0-f43.google.com [74.125.82.43]) by dpdk.org (Postfix) with ESMTP id 36A65691A for ; Wed, 8 Mar 2017 23:04:03 +0100 (CET) Received: by mail-wm0-f43.google.com with SMTP id n11so125893599wma.1 for ; Wed, 08 Mar 2017 14:04:03 -0800 (PST) In-Reply-To: <20170228185315.12546-21-aconole@redhat.com> List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 2017-02-28 13:53, Aaron Conole: > + int ret_1 = 0; You do not need to add a new variable. > int ret = 0; > > if (rte_eal_devargs_type_count(RTE_DEVTYPE_WHITELISTED_PCI) == 0) > @@ -430,17 +432,20 @@ rte_eal_pci_probe(void) > > /* probe all or only whitelisted devices */ > if (probe_all) > - ret = pci_probe_all_drivers(dev); > + ret_1 = pci_probe_all_drivers(dev); > else if (devargs != NULL && > devargs->type == RTE_DEVTYPE_WHITELISTED_PCI) > - ret = pci_probe_all_drivers(dev); > - if (ret < 0) > - rte_exit(EXIT_FAILURE, "Requested device " PCI_PRI_FMT > + ret_1 = pci_probe_all_drivers(dev); > + if (ret_1 < 0) { > + RTE_LOG(ERR, EAL, "Requested device " PCI_PRI_FMT > " cannot be used\n", dev->addr.domain, dev->addr.bus, > dev->addr.devid, dev->addr.function); > + rte_errno = errno; > + ret = 1; > + } > } > > - return 0; > + return -ret; It may be more explicit to use only one variable ret and filter the positive values: ret < 0 ? -1 : 0