Skip to content

Commit

Permalink
app/testpmd: remove redundant policy action condition
Browse files Browse the repository at this point in the history
[ upstream commit 4c2e746 ]

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: f29fa2c ("app/testpmd: support policy actions per color")

Signed-off-by: Stephen Hemminger <[email protected]>
Acked-by: Bruce Richardson <[email protected]>
Acked-by: Ajit Khaparde <[email protected]>
Acked-by: Chengwen Feng <[email protected]>
  • Loading branch information
shemminger authored and steevenlee committed Dec 6, 2024
1 parent e5eb4ae commit 1fb0641
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion app/test-pmd/config.c
Original file line number Diff line number Diff line change
Expand Up @@ -2219,7 +2219,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;
Expand Down

0 comments on commit 1fb0641

Please sign in to comment.