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 8261F45CFB; Thu, 14 Nov 2024 01:14:39 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0F97B42708; Thu, 14 Nov 2024 01:14:22 +0100 (CET) Received: from mail-pf1-f180.google.com (mail-pf1-f180.google.com [209.85.210.180]) by mails.dpdk.org (Postfix) with ESMTP id 281B14114B for ; Thu, 14 Nov 2024 01:14:20 +0100 (CET) Received: by mail-pf1-f180.google.com with SMTP id d2e1a72fcca58-723f37dd76cso8880b3a.0 for ; Wed, 13 Nov 2024 16:14:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1731543259; x=1732148059; 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=Hb2Vb3vSP+AW6E8/io5Cdc8yJa0ePhS2WwpQB51e5C0=; b=rWuGywTA+K/cG84LTqHNreQHWfmBaQsr96SIlOpmWRrmeKZk/cpf0t7h3NflGEnmKp JsrCtcTJCYRkdMj2x8rbuE17HpraL5XxqGQuTPEi2tHaTbs6aqh60NuRgY95Aw5k0U9G yM13oMtlEq8xJQ6OmaNpfST6rb0h3Uh0ZcNJ3SUFxPNM0IQR0i5ayaDcTa6IcNMVJDX0 EfAz6dh34Yz+Ofj0qLzs31SyeXYrraQmzjz/PNDPturUvZeO5W97R9oh35j/FMB9JSp7 Vla2PG5QhKfvXq1z5kuqKQVfY/EJijlTXkpLsP0e40wyMX81iRsznLZDRD/qQits8eo8 iKVQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731543259; x=1732148059; 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=Hb2Vb3vSP+AW6E8/io5Cdc8yJa0ePhS2WwpQB51e5C0=; b=q/i4tSh/ccuor2lfynymInB5lndAlZDUqmAJO2JTbr/XQrMwxLnZPvuglv8DdZQLx+ jCSvtJxLyp5rPoP6oxW3kHyF9yoLIGhbmoTt9mSjFeV/DLMvxdROd97arvbFHrD3ATQd nkVt2+I3hZ395pffa42ZYwC8IiJzm4XqmMM1lyQWXaz9XrckmQge2YtHUKI0wYTO7Fn2 vytv9uLjB3MCjuU7SemwkEqrNb8QY14pKCFSp5PeyyZPfktpiL8xrRp63V2wUW5ka3xg fyPA8VGV3YZjyYhapwdmbTU7BckOfvKwfUGPiJysVVn83JK5Gj6DvOUQJdqGVF9Xg1gX FNyw== X-Gm-Message-State: AOJu0Yy4rTPoF4N6ClnBLQ3ioPRsvZdeUUQM0wbmrUbjYRK7NgnM4xKf q/9nA2AGnB2JFwYiJlbbDEqygGNws5exCGOW3n44xfdvsG9byWObhkehCkcWFq/dcPIWLrOkyqa W X-Google-Smtp-Source: AGHT+IEXWge9CKFYNtkGKxK1gvFFBAClOooVFJ9Q+cEOOPpEen44ROrqdtl+S7c7NQSPZJnG6+09sA== X-Received: by 2002:a05:6a00:18a2:b0:71e:4930:162c with SMTP id d2e1a72fcca58-7245799d0b3mr5596717b3a.6.1731543259082; Wed, 13 Nov 2024 16:14:19 -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.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Nov 2024 16:14:18 -0800 (PST) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , jerin.jacob@caviumnetworks.com, Abhinandan Gujjar , Bruce Richardson Subject: [RFC 04/10] app/test: avoid duplicate initialization Date: Wed, 13 Nov 2024 16:12:16 -0800 Message-ID: <20241114001403.147609-5-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 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 --- 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