From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id C8FC145D79; Fri, 22 Nov 2024 01:33:40 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id BA70E432FC; Fri, 22 Nov 2024 01:33:40 +0100 (CET) Received: from szxga05-in.huawei.com (szxga05-in.huawei.com [45.249.212.191]) by mails.dpdk.org (Postfix) with ESMTP id 782C5432C2 for ; Fri, 22 Nov 2024 01:33:38 +0100 (CET) Received: from mail.maildlp.com (unknown [172.19.162.112]) by szxga05-in.huawei.com (SkyGuard) with ESMTP id 4Xvbd42YsMz1k097; Fri, 22 Nov 2024 08:31:36 +0800 (CST) Received: from kwepemk500009.china.huawei.com (unknown [7.202.194.94]) by mail.maildlp.com (Postfix) with ESMTPS id 2C3F314044F; Fri, 22 Nov 2024 08:33:37 +0800 (CST) Received: from [10.67.121.161] (10.67.121.161) by kwepemk500009.china.huawei.com (7.202.194.94) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Fri, 22 Nov 2024 08:33:36 +0800 Message-ID: Date: Fri, 22 Nov 2024 08:33:36 +0800 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v4 8/9] app/test-pmd: remove redundant condition To: Stephen Hemminger , CC: , Bruce Richardson , Ajit Khaparde , Aman Singh , Matan Azrad References: <20241114001403.147609-1-stephen@networkplumber.org> <20241121182443.68025-1-stephen@networkplumber.org> <20241121182443.68025-9-stephen@networkplumber.org> Content-Language: en-US From: fengchengwen In-Reply-To: <20241121182443.68025-9-stephen@networkplumber.org> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.67.121.161] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To kwepemk500009.china.huawei.com (7.202.194.94) X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Acked-by: Chengwen Feng On 2024/11/22 2:23, Stephen Hemminger 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@nvidia.com > Signed-off-by: Stephen Hemminger > Acked-by: Bruce Richardson > Acked-by: Ajit Khaparde > --- > 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 28d45568ac..4e7fb69183 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; > @@ -7338,4 +7338,3 @@ show_mcast_macs(portid_t port_id) > printf(" %s\n", buf); > } > } > -