From mboxrd@z Thu Jan 1 00:00:00 1970 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) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id; bh=oCbep6S+VKZS+z1yEHprKHyrqdI3cwGvbMySk7wFWu8=; b=gO7Vyv93U8pebCTWbuDuvwSCqIR/gwlf8MY7vFd+DdRuuE/sQfM+XoGhseSIW/zkmv yFcaLHToxEF8kLDkIkDPXTBjn49mL/m+neOFdR18ZAHt2CDp0pLZIYnuoXf8N2jOdBnA oQHdFmJ7rQ5cFp+kuwlW6sIQhpf35lX0V91kR2T7FpzAMyLlMTRXpzcbkDcDpAJm2jw/ UPWbmwrE7FbFDeL8NMRj9ufEiUWgwp27+U1++p9YjyXmnJTtsto2YN8KOc3aFaHzgYWz /iI0r5HOhIfBDUuT4TrTVKvEUrobGcuHGv8ZO19jqzDS8xQtzjvKdm0MjhaQzqXKS+/J HdqQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=oCbep6S+VKZS+z1yEHprKHyrqdI3cwGvbMySk7wFWu8=; b=tsneyt2bp9sDcsZeyW8WyADvOgK/F717u/fatmSOTvtxjR9KfrC9JApEKmEPqKlSF3 d99W3p/Vl80A+YnTIG9YlgfuvBjVtbvlcTNk42vxmtkDIXUT8YK6fRvnmWf58E58nAEb tuc0x3l1h8582V5fKymDMgQ9ePnysDlfd6/hMcT9olXdKc+9rocrTLYF6sM7mzWIxMYO Oo0ogVts6b2HhtWeUGaS5nlOHwVSwgcrKwv3kxUTn35AlIk8/20QSv35mv8xEzFJ6+TC rxxvh6Wbm2iwszd+t1QSXzAzh2XB6aWQcMtc05GY1wbArT7xPnVwcMRdAWoHjZtAJVmS 4jfg== X-Gm-Message-State: AElRT7EoCVMsJivx/tSdCK7ul5e9/xOo1BjI6swJr4lC6WTJ1cmNofi1 nv7tbnE21yjRsFX+09j0ZzcT/8Sh X-Google-Smtp-Source: AG47ELu4r4buUrMwSSCGEJFIbEkxn+TbrdYnyy37/OQbefhHTNd5svaKqhWsFAPVSbYxySJtBKXp5Q== X-Received: by 10.28.134.203 with SMTP id i194mr5611762wmd.114.1521714544419; Thu, 22 Mar 2018 03:29:04 -0700 (PDT) Received: from bidouze.dev.6wind.com. (host.78.145.23.62.rev.coltfrance.com. [62.23.145.78]) by smtp.gmail.com with ESMTPSA id n190sm6738069wmb.15.2018.03.22.03.29.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 22 Mar 2018 03:29:03 -0700 (PDT) From: Gaetan Rivet To: dev@dpdk.org Cc: Gaetan Rivet , stable@dpdk.org, Hemant Agrawal , Shreyansh Jain Date: Thu, 22 Mar 2018 11:28:44 +0100 Message-Id: <20180322102844.8109-1-gaetan.rivet@6wind.com> X-Mailer: git-send-email 2.11.0 Subject: [dpdk-dev] [PATCH v1] bus/fslmc: fix find device start condition 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: , X-List-Received-Date: Thu, 22 Mar 2018 10:29:05 -0000 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