Even if whitelist of devices is provided, rte_pci_probe() increments
the probed counter for all the devices present in the system. If probe
fails for all the whitelisted devices it still return success because
failed and probed counts don't match.

This patch increments probed count only when devices are actually
probed.

Signed-off-by: Nitin Katiyar <nitin.kati...@ericsson.com>
Signed-off-by: Venkatesan Pradeep <venkatesan.prad...@ericsson.com>

---
 drivers/bus/pci/pci_common.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/bus/pci/pci_common.c b/drivers/bus/pci/pci_common.c
index 6b46b4f..25d1002 100644
--- a/drivers/bus/pci/pci_common.c
+++ b/drivers/bus/pci/pci_common.c
@@ -300,15 +300,17 @@ static struct rte_devargs *pci_devargs_lookup(struct 
rte_pci_device *dev)
                probe_all = 1;
 
        FOREACH_DEVICE_ON_PCIBUS(dev) {
-               probed++;
-
                devargs = dev->device.devargs;
                /* probe all or only whitelisted devices */
-               if (probe_all)
+               if (probe_all) {
                        ret = pci_probe_all_drivers(dev);
+                       probed++;
+               }
                else if (devargs != NULL &&
-                       devargs->policy == RTE_DEV_WHITELISTED)
+                       devargs->policy == RTE_DEV_WHITELISTED) {
                        ret = pci_probe_all_drivers(dev);
+                       probed++;
+               }
                if (ret < 0) {
                        if (ret != -EEXIST) {
                                RTE_LOG(ERR, EAL, "Requested device "
-- 
1.9.1

Reply via email to