From mboxrd@z Thu Jan 1 00:00:00 1970 From: Gaetan Rivet Subject: [PATCH v1] bus/fslmc: fix find device start condition Date: Thu, 22 Mar 2018 11:28:44 +0100 Message-ID: <20180322102844.8109-1-gaetan.rivet@6wind.com> Cc: Gaetan Rivet , stable@dpdk.org, Hemant Agrawal , Shreyansh Jain To: dev@dpdk.org Return-path: Received: from mail-wm0-f65.google.com (mail-wm0-f65.google.com [74.125.82.65]) by dpdk.org (Postfix) with ESMTP id 5F5234C7C for ; Thu, 22 Mar 2018 11:29:05 +0100 (CET) Received: by mail-wm0-f65.google.com with SMTP id l9so14963083wmh.2 for ; Thu, 22 Mar 2018 03:29:05 -0700 (PDT) List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" If start is set and a device before it matches the data, this device is returned. Fixes: c7fe1eea8a74 ("bus: simplify finding starting point") Cc: stable@dpdk.org Cc: Hemant Agrawal Cc: Shreyansh Jain Signed-off-by: Gaetan Rivet --- Hi Shreyansh, Hemant, Sorry, I did not test this. I found this issue while working on vdev and PCI. There is a better way to iterate on devices [1], but the gain is really minimal and the implementation slightly more complex. I preferred to avoid complex, as I could not test this patch. Regards, [1]: http://dpdk.org/ml/archives/dev/2018-March/092906.html drivers/bus/fslmc/fslmc_bus.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/bus/fslmc/fslmc_bus.c b/drivers/bus/fslmc/fslmc_bus.c index 5ee0beb85..010dd474e 100644 --- a/drivers/bus/fslmc/fslmc_bus.c +++ b/drivers/bus/fslmc/fslmc_bus.c @@ -301,8 +301,9 @@ rte_fslmc_find_device(const struct rte_device *start, rte_dev_cmp_t cmp, struct rte_dpaa2_device *dev; TAILQ_FOREACH(dev, &rte_fslmc_bus.device_list, next) { - if (start && &dev->device == start) { - start = NULL; /* starting point found */ + if (start != NULL) { + if (&dev->device == start) + start = NULL; /* starting point found */ continue; } -- 2.11.0