[RFC 07/10] app/test-pmd: remove redundant condition

Stephen Hemminger stephen at networkplumber.org
Thu Nov 14 01:12:19 CET 2024


The loop over policy actions will always exit when it sees
the flow end action, so the next check is redundant.

Link: https://pvs-studio.com/en/blog/posts/cpp/1179/

Fixes: f29fa2c59b85 ("app/testpmd: support policy actions per color")
Cc: haifeil at nvidia.com
Signed-off-by: Stephen Hemminger <stephen at networkplumber.org>
---
 app/test-pmd/config.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index 88770b4dfc..32c4e86c84 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -2288,7 +2288,7 @@ port_meter_policy_add(portid_t port_id, uint32_t policy_id,
 		for (act_n = 0, start = act;
 			act->type != RTE_FLOW_ACTION_TYPE_END; act++)
 			act_n++;
-		if (act_n && act->type == RTE_FLOW_ACTION_TYPE_END)
+		if (act_n > 0)
 			policy.actions[i] = start;
 		else
 			policy.actions[i] = NULL;
@@ -7316,4 +7316,3 @@ show_mcast_macs(portid_t port_id)
 		printf("  %s\n", buf);
 	}
 }
-
-- 
2.45.2



More information about the dev mailing list