[dpdk-dev,v1] bus/fslmc: fix find device start condition

Message ID 20180322102844.8109-1-gaetan.rivet@6wind.com (mailing list archive)
State Accepted, archived
Delegated to: Thomas Monjalon
Headers

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation fail Compilation issues

Commit Message

Gaëtan Rivet March 22, 2018, 10:28 a.m. UTC
  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 <hemant.agrawal@nxp.com>
Cc: Shreyansh Jain <shreyansh.jain@nxp.com>
Signed-off-by: Gaetan Rivet <gaetan.rivet@6wind.com>
---

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(-)
  

Comments

Shreyansh Jain March 23, 2018, 8:52 a.m. UTC | #1
On Thu, Mar 22, 2018 at 3:58 PM, Gaetan Rivet <gaetan.rivet@6wind.com> wrote:
> 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 <hemant.agrawal@nxp.com>
> Cc: Shreyansh Jain <shreyansh.jain@nxp.com>
> Signed-off-by: Gaetan Rivet <gaetan.rivet@6wind.com>
> ---
>
> 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
>

I think this change should suffice here. Thanks.

(On a side note, it seems compilation using clang is failing for this
patch [1] though it is not related to this change. I will look into
that)

[1] http://dpdk.org/ml/archives/test-report/2018-March/044684.html

Acked-by: Shreyansh Jain <shreyansh.jain@nxp.com>
  
Thomas Monjalon April 4, 2018, 10:46 p.m. UTC | #2
23/03/2018 09:52, Shreyansh Jain:
> On Thu, Mar 22, 2018 at 3:58 PM, Gaetan Rivet <gaetan.rivet@6wind.com> wrote:
> > 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 <hemant.agrawal@nxp.com>
> > Cc: Shreyansh Jain <shreyansh.jain@nxp.com>
> > Signed-off-by: Gaetan Rivet <gaetan.rivet@6wind.com>
> > ---
> >
> > 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
> >
> 
> I think this change should suffice here. Thanks.
> 
> (On a side note, it seems compilation using clang is failing for this
> patch [1] though it is not related to this change. I will look into
> that)
> 
> [1] http://dpdk.org/ml/archives/test-report/2018-March/044684.html
> 
> Acked-by: Shreyansh Jain <shreyansh.jain@nxp.com>

Applied, thanks
  

Patch

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;
 		}