[PATCH v3 08/10] app/test-pmd: remove redundant condition

Ajit Khaparde ajit.khaparde at broadcom.com
Fri Nov 15 21:52:13 CET 2024


On Fri, Nov 15, 2024 at 12:08 PM Stephen Hemminger
<stephen at networkplumber.org> wrote:
>
> 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>
> Acked-by: Bruce Richardson <bruce.richardson at intel.com>
Acked-by: Ajit Khaparde <ajit.khaparde at broadcom.com>

> ---
>  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
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4218 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://mails.dpdk.org/archives/dev/attachments/20241115/a5b80baf/attachment-0001.bin>


More information about the dev mailing list