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 0D6FB4C7C for ; Thu, 22 Mar 2018 11:29:05 +0100 (CET) Received: by mail-wm0-f65.google.com with SMTP id l9so14963048wmh.2 for ; Thu, 22 Mar 2018 03:29:04 -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=HkPAFwsZ6ykNeGvHssvJs0AxRir1HE6Eqabw8CNmqM5JGwKdftALizk6sRkuKakT85 xv3jbNlPgYcHQQfx8dxgH/JbNBApZiifx6EhrX843wepA3D9EdlKvOpzxP/7O5T+ddoh bjU6cSTLugI5hSPGJbjL+U9mMqVCxwP4iPLzhYa3weprWCfzfmANqS/h4TlBFIC16tcU drt6R97e1UFPZKq8sHR+ISVol/OrR0E3d9mn8rL/BBbfSJ1xvdvCuQCPlIenJKVAAzHX moIvK2pckA//Z/WDwRWQERBMxtHil1BKl7buX0cpeWdnePMn6ChFefBV4YWaxN72MJLC OpJw== X-Gm-Message-State: AElRT7G+fKxIrt3MXRwnPOoKhzYUUtK+BeXgfw1E+O7NkSnxdJbAdVOF /7YjYH9NipDkGf8/iPER49vY7A== 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-stable] [PATCH v1] bus/fslmc: fix find device start condition 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: , 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