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 C548D45CFB; Thu, 14 Nov 2024 01:14:58 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 5D56B427A9; Thu, 14 Nov 2024 01:14:27 +0100 (CET) Received: from mail-pf1-f176.google.com (mail-pf1-f176.google.com [209.85.210.176]) by mails.dpdk.org (Postfix) with ESMTP id 34CD542788 for ; Thu, 14 Nov 2024 01:14:23 +0100 (CET) Received: by mail-pf1-f176.google.com with SMTP id d2e1a72fcca58-71e5130832aso5057b3a.0 for ; Wed, 13 Nov 2024 16:14:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1731543262; x=1732148062; darn=dpdk.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=V7BoOSRMcB41TxT9hCgHuA+T+3RNhORnxBMubQ2BvNE=; b=Lj5r8Xnv0a4+8QYAa3+kizD5dD9S8ubkxaypvpjElxJ+wUrH2YKagB6s/E9zkb+rzq xpLERyv4WM3Z5FcD4QXlpxC8Uds4NJIoHX0VnZQurWrDJwm8GidUkmKgLa1JzkzAsHLF r5e5IdmKPPCzMYq/OTXpN65kXRtvG64pNrgJiIK1wsACUtavY+wk8Q2ALO8vbrI1xvuF IYcS+rgAJXRBOZNRKM26vlW/7muq7zVtySAHOO2eDj170iuhNCkEq8RfU9AABij5hNn1 +WklB+vGVhb7WuZCcxVxq6/V4qnGAXzMwf2lVDBrs/yBfi/qclX3XZA+n3KtvgpnIeyM Gk5g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731543262; x=1732148062; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=V7BoOSRMcB41TxT9hCgHuA+T+3RNhORnxBMubQ2BvNE=; b=lNByQAAcMBrENyl7h1bGsgpGZPDijjVbWx+0zPZULrf4FsLgKSkfLtiGBVEyyfjj26 9l2D32MSm1ROrs7zAd3rLkotGi1vjuL1ZXcbKoePGq98dvBnWeP7rGzw1VGKL9aFnsYu 7g2Z4zpazcsx0hDlcon/LwtMbp6o+tlTX9JV8VLhY+OPYriA3ig4fKAEY9uuo408dSSm IHnfclC9oaHYL9DGKf1hGK+LlRDL/nqMH1haf9odPn1sjqnlpca4rDZhhw14uQeZQ34x xTQGQpmwfbZxGVaquaYdVwJYqfk1gGo2YGjLpE277rq3DZpiZJs9HidcLCIbgWIi4GSS sUOg== X-Gm-Message-State: AOJu0YzecxINCJoSgQlHe/28G5/HYubnhyU/eLFAxrVgvSSCcGFvsu46 e5DXYpk/fGlT2i9RbCyjvC0FgpHuiJYblz+DlC7A7s4JZeIj2EIv3BrNGTUKmZ8gDYHSV1OgFtx 7 X-Google-Smtp-Source: AGHT+IEUZYl3dWS1A+kp4CiiFPBg2Noda9r5hN/x7e+f5FhWSW+//DVn3bZY1unhnF35pfpuxaEfXw== X-Received: by 2002:a05:6a00:13a9:b0:71e:4a51:2007 with SMTP id d2e1a72fcca58-72469c25387mr312332b3a.4.1731543262343; Wed, 13 Nov 2024 16:14:22 -0800 (PST) Received: from hermes.local (204-195-96-226.wavecable.com. [204.195.96.226]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-7246a9a81a9sm9280b3a.99.2024.11.13.16.14.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Nov 2024 16:14:22 -0800 (PST) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , haifeil@nvidia.com, Aman Singh , Matan Azrad , Ajit Khaparde Subject: [RFC 07/10] app/test-pmd: remove redundant condition Date: Wed, 13 Nov 2024 16:12:19 -0800 Message-ID: <20241114001403.147609-8-stephen@networkplumber.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241114001403.147609-1-stephen@networkplumber.org> References: <20241114001403.147609-1-stephen@networkplumber.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 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 --- 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