The RTE_FOREACH_MATCHING_DEV iterator requires that
if a break is done before the end of the loop,
the function rte_eth_iterator_cleanup() must be called.

Fixes: 55e51c962432 ("app/testpmd: add device related commands")
Cc: ndabilpu...@marvell.com
Cc: sta...@dpdk.org
Signed-off-by: Stephen Hemminger <step...@networkplumber.org>
---
 app/test-pmd/testpmd.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index 446da3623442..cf59c378229f 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -2616,6 +2616,7 @@ detach_device(char *identifier)
                if (ports[port_id].port_status != RTE_PORT_CLOSED) {
                        if (ports[port_id].port_status != RTE_PORT_STOPPED) {
                                printf("Port %u not stopped\n", port_id);
+                               rte_eth_iterator_cleanup(&iterator);
                                return;
                        }
 
-- 
2.20.1

Reply via email to