From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124])
	by inbox.dpdk.org (Postfix) with ESMTP id 969F945D6B;
	Thu, 21 Nov 2024 19:25:22 +0100 (CET)
Received: from mails.dpdk.org (localhost [127.0.0.1])
	by mails.dpdk.org (Postfix) with ESMTP id 0693643005;
	Thu, 21 Nov 2024 19:25:04 +0100 (CET)
Received: from mail-pf1-f175.google.com (mail-pf1-f175.google.com
 [209.85.210.175])
 by mails.dpdk.org (Postfix) with ESMTP id 525E242F9F
 for <dev@dpdk.org>; Thu, 21 Nov 2024 19:24:58 +0100 (CET)
Received: by mail-pf1-f175.google.com with SMTP id
 d2e1a72fcca58-723f37dd76cso1275265b3a.0
 for <dev@dpdk.org>; Thu, 21 Nov 2024 10:24:58 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1732213497;
 x=1732818297; 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=T+5TWmYQJTafHf1SEtkoaQZh+BxB5xVfNprnhf7L0jM=;
 b=aH5g9cLVuujm0Y6+0rVXb7OTkWwhfiwj91fFpfpjw6+QhzCVMOjzUzqdUXCwlu4UCh
 8YkaVYCZsrLq7sukvJ0KUx2c1FuL5zThq2lUeUbbbfb5ZfhyNVwwRnqMEfREkBv7/blH
 nmMjpJrNTboSF+DjSWGooznwcqhlNYuYAuYBoZEvP4vgB2J4p2A23GA5U3fcuk72CxD1
 RYDJuwFxbWvIj2rOZdJr3kxq7eW0TkCiq1uBAUDSolPm24EMQ2KYUFTZ2p8B8qkGeW5p
 ov5XSD0I3H7bPFVMGUpiC3Nic/NTsEXBjLNrlR5TIcggq7SiJDWrIAI8PlJTEQL5D8lJ
 sDyA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1732213497; x=1732818297;
 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=T+5TWmYQJTafHf1SEtkoaQZh+BxB5xVfNprnhf7L0jM=;
 b=jCwXA2pMUM2MFlyTDYArRZlMVq+xMKL+SS4dwCfJ1FWvVnCy36rX4O+SNuQaqnGexu
 58rDcmOBph5SHnK9enY+iHe8UQhgxSqbQFbH2ZfSEPCUqGIa2BQFFubAsjXjnpZ+5qHu
 bC1RNxj28ERM156waNR2y1oakL2UMm6QEFopE+96QFjuhQEULTKdIbS569wHpo4GtuQY
 iWIawXtb1Ry1N7IPIBSH7A0QJZaU8Akg4mxjnY4wTvcSsZLJlTilOKW5T0enadBvZyFl
 b5Y3rh90s3UMSlKRI56uzEBT7CPseGshimYn3u5fbQxxMoJryghiBaAdq0BhvPEfdUjf
 aTpA==
X-Gm-Message-State: AOJu0YyV7JHdQPWt6Vnef3DEHDaCiDxsyqT7p0HlbxqNRMNXcBuEPcrD
 8JLM2gd423rZCbN26j7PNrW7JAW8B6VM3WjDSxzZHTaanwmdARcF/ZUFuvxTaT9u4J4fo7K2cGJ
 lJWM=
X-Gm-Gg: ASbGncvB7BZZ4f3P3KeXJErsV8ElaUQgvd/QAN3JIECatkDKz6WpBCq713cwcHJb+gm
 LXW0IZLrrCFdDNdbGohdbelPh+zGLCQBxBZcSZc6WLVpau/lFiAU8zJpAAcL0Essd/WvMWDy1+p
 T0TNo5EjEKkZBJ2XU3kAwttw+wk5yXlGQsVG1QAYD8hBpcLwONqh2Ap4vjAXTTHUqO8ThRG4pMy
 px79K5V2tcI1CJtMBDb0rAJixUyyaqJoDrCi38yKGM6+gfqdGwbCdQ3ja5uPj5iahs/GAcYrS8/
 GF9SguXm72zC9vYwlf17ZTGpIyA=
X-Google-Smtp-Source: AGHT+IHrFNcS2C7Kz6y18nm/jSO6ujwyGrH9DcpsqnGZGc6PhtAh2W8nqP+OHV+e39p/dTCHhr5cAg==
X-Received: by 2002:a05:6a20:9c8a:b0:1db:dafa:e9da with SMTP id
 adf61e73a8af0-1ddafc59893mr11701859637.27.1732213497431; 
 Thu, 21 Nov 2024 10:24:57 -0800 (PST)
Received: from hermes.local (204-195-96-226.wavecable.com. [204.195.96.226])
 by smtp.gmail.com with ESMTPSA id
 d2e1a72fcca58-724de454aa1sm70201b3a.4.2024.11.21.10.24.56
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Thu, 21 Nov 2024 10:24:57 -0800 (PST)
From: Stephen Hemminger <stephen@networkplumber.org>
To: dev@dpdk.org
Cc: Stephen Hemminger <stephen@networkplumber.org>,
 jerin.jacob@caviumnetworks.com,
 Bruce Richardson <bruce.richardson@intel.com>,
 Abhinandan Gujjar <abhinandan.gujjar@intel.com>
Subject: [PATCH v4 4/9] app/test: avoid duplicate initialization
Date: Thu, 21 Nov 2024 10:23:25 -0800
Message-ID: <20241121182443.68025-5-stephen@networkplumber.org>
X-Mailer: git-send-email 2.45.2
In-Reply-To: <20241121182443.68025-1-stephen@networkplumber.org>
References: <20241114001403.147609-1-stephen@networkplumber.org>
 <20241121182443.68025-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 <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org

The event_dev_config initialization had duplicate assignments
to the same element. Change to use structure initialization
so that compiler will catch this type of bug.

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

Fixes: f8f9d233ea0e ("test/eventdev: add unit tests")
Cc: jerin.jacob@caviumnetworks.com

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: Abhinandan Gujjar <abhinandan.gujjar@intel.com>
---
 app/test/test_event_crypto_adapter.c | 24 ++++++++++--------------
 1 file changed, 10 insertions(+), 14 deletions(-)

diff --git a/app/test/test_event_crypto_adapter.c b/app/test/test_event_crypto_adapter.c
index 9d38a66bfa..ab24e30a97 100644
--- a/app/test/test_event_crypto_adapter.c
+++ b/app/test/test_event_crypto_adapter.c
@@ -1154,21 +1154,17 @@ configure_cryptodev(void)
 
 static inline void
 evdev_set_conf_values(struct rte_event_dev_config *dev_conf,
-			struct rte_event_dev_info *info)
+		      const struct rte_event_dev_info *info)
 {
-	memset(dev_conf, 0, sizeof(struct rte_event_dev_config));
-	dev_conf->dequeue_timeout_ns = info->min_dequeue_timeout_ns;
-	dev_conf->nb_event_ports = NB_TEST_PORTS;
-	dev_conf->nb_event_queues = NB_TEST_QUEUES;
-	dev_conf->nb_event_queue_flows = info->max_event_queue_flows;
-	dev_conf->nb_event_port_dequeue_depth =
-			info->max_event_port_dequeue_depth;
-	dev_conf->nb_event_port_enqueue_depth =
-			info->max_event_port_enqueue_depth;
-	dev_conf->nb_event_port_enqueue_depth =
-			info->max_event_port_enqueue_depth;
-	dev_conf->nb_events_limit =
-			info->max_num_events;
+	*dev_conf = (struct rte_event_dev_config) {
+		.dequeue_timeout_ns = info->min_dequeue_timeout_ns,
+		.nb_event_ports = NB_TEST_PORTS,
+		.nb_event_queues = NB_TEST_QUEUES,
+		.nb_event_queue_flows = info->max_event_queue_flows,
+		.nb_event_port_dequeue_depth = info->max_event_port_dequeue_depth,
+		.nb_event_port_enqueue_depth = info->max_event_port_enqueue_depth,
+		.nb_events_limit = info->max_num_events,
+	};
 }
 
 static int
-- 
2.45.2