From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from dpdk.org (dpdk.org [92.243.14.124])
	by inbox.dpdk.org (Postfix) with ESMTP id 6F141A2EFC
	for <public@inbox.dpdk.org>; Tue, 17 Sep 2019 09:59:02 +0200 (CEST)
Received: from [92.243.14.124] (localhost [127.0.0.1])
	by dpdk.org (Postfix) with ESMTP id 1765B1BFF4;
	Tue, 17 Sep 2019 09:58:15 +0200 (CEST)
Received: from mail-lf1-f65.google.com (mail-lf1-f65.google.com
 [209.85.167.65]) by dpdk.org (Postfix) with ESMTP id A391B1BFB2
 for <dev@dpdk.org>; Tue, 17 Sep 2019 09:58:02 +0200 (CEST)
Received: by mail-lf1-f65.google.com with SMTP id u28so2083068lfc.5
 for <dev@dpdk.org>; Tue, 17 Sep 2019 00:58:02 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=semihalf-com.20150623.gappssmtp.com; s=20150623;
 h=from:to:cc:subject:date:message-id:in-reply-to:references;
 bh=bK9nl/qV04wjIKeztaLOLubH2UF/0ajtfJqFha0o/9s=;
 b=QavRhPGWaxURYAkkGptuOInGnGMyZ4WCp2IcjcQe40T61JdNLw3CpMkv8IAqvL0CI8
 RyP0JLH0AkYlxiyJbZzSv5IKPP137DGDkK/s6K2kxlgEYTWQ5GjULHvhqn6Y8ltsCJwo
 od+LAXSxjJo8Mso0ncUBpRz6Ot+0Z+EjdkMaj4lCLrXrHx26sh0XR9ix2rb1WO7EqlH3
 M4IYGpKhS7MlvJG1tFOWmHj7i5B78FM4X4xxymLVrhjecy2DKcOnm3USJ8CRLYnSOrbj
 sexc+/QQJejChD1eGN2WM1sPt8CsfWXRNXNCr08MCpOVz2IryXjDCVXsnHtcO/PJP+AR
 a5Lg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to
 :references;
 bh=bK9nl/qV04wjIKeztaLOLubH2UF/0ajtfJqFha0o/9s=;
 b=bOs49lUnINOuCTWLLJv9TDaUz/cclp1YsADWNIxwFg0JAu8y7yer1x243ecTthZIfR
 CjYaJ/1OWX7771yl07tPklGlS1qhgr8+VgwYxmAjOnY6NFi7NxJqpIx5mhgrKHucZRbs
 sZdAXqOaz5QZMV3pWybX7DsKm6CgDOk0vLqsfgdeg1ReRyZTMoyW31ov7sp8UOulmN83
 EjHSq9wKh6D2aXieuLVZFoqqGO/sgUYps+kC/YztAWUU1Z6Kdbcp6XUTK+XfmUSzV01i
 h6q6ZDhmWKy5HFCBTfxezLiUXgTOPXhAb0VM69tFhZQRJBhwcpTSTpFg9XmV6bJUzoWL
 mZwQ==
X-Gm-Message-State: APjAAAU8nN5iZh6v5v1hwPS3H+8Dv1n0mbNoIEe5XtyHjTSU38B9M2Xr
 GH8OuhS8Bzpw9jUKVFXrumnQchjQI3dgcQ==
X-Google-Smtp-Source: APXvYqy4jBnt4xDFdapKfYlblJWAm59J2P4sMLlZfzlttu/6i6waL/K6z4x1jtzEKJxEAY4t79nYJA==
X-Received: by 2002:ac2:562c:: with SMTP id b12mr1363538lff.156.1568707081885; 
 Tue, 17 Sep 2019 00:58:01 -0700 (PDT)
Received: from localhost.localdomain (31-172-191-173.noc.fibertech.net.pl.
 [31.172.191.173])
 by smtp.googlemail.com with ESMTPSA id g1sm270659ljl.31.2019.09.17.00.58.01
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Tue, 17 Sep 2019 00:58:01 -0700 (PDT)
From: Andrzej Ostruszka <amo@semihalf.com>
To: dev@dpdk.org, Hemant Agrawal <hemant.agrawal@nxp.com>,
 Sachin Saxena <sachin.saxena@nxp.com>
Cc: mattias.ronnblom@ericsson.com, stephen@networkplumber.org,
 Andrzej Ostruszka <aostruszka@marvell.com>
Date: Tue, 17 Sep 2019 09:57:50 +0200
Message-Id: <20190917075754.8310-7-amo@semihalf.com>
X-Mailer: git-send-email 2.17.1
In-Reply-To: <20190917075754.8310-1-amo@semihalf.com>
References: <20190917075754.8310-1-amo@semihalf.com>
Subject: [dpdk-dev] [PATCH v2 06/10] net/dpaa2: fix possible use of
	uninitialized vars
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
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
Sender: "dev" <dev-bounces@dpdk.org>

This patch fixes 'maybe-uninitialized' warnings reported by compiler
when using LTO.

Signed-off-by: Andrzej Ostruszka <aostruszka@marvell.com>
---
 drivers/net/dpaa2/base/dpaa2_hw_dpni.c | 1 +
 drivers/net/dpaa2/mc/dpkg.c            | 2 +-
 drivers/net/dpaa2/mc/dpni.c            | 9 ++++++---
 3 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/drivers/net/dpaa2/base/dpaa2_hw_dpni.c b/drivers/net/dpaa2/base/dpaa2_hw_dpni.c
index 56e2e56a3..2f6534a31 100644
--- a/drivers/net/dpaa2/base/dpaa2_hw_dpni.c
+++ b/drivers/net/dpaa2/base/dpaa2_hw_dpni.c
@@ -51,6 +51,7 @@ rte_pmd_dpaa2_set_custom_hash(uint16_t port_id,
 	kg_cfg.extracts[0].type = DPKG_EXTRACT_FROM_DATA;
 	kg_cfg.extracts[0].extract.from_data.offset = offset;
 	kg_cfg.extracts[0].extract.from_data.size = size;
+	kg_cfg.extracts[0].num_of_byte_masks = 0;
 	kg_cfg.num_extracts = 1;
 
 	ret = dpkg_prepare_key_cfg(&kg_cfg, p_params);
diff --git a/drivers/net/dpaa2/mc/dpkg.c b/drivers/net/dpaa2/mc/dpkg.c
index 80f94f40e..7aa63ea12 100644
--- a/drivers/net/dpaa2/mc/dpkg.c
+++ b/drivers/net/dpaa2/mc/dpkg.c
@@ -63,7 +63,7 @@ dpkg_prepare_key_cfg(const struct dpkg_profile_cfg *cfg, uint8_t *key_cfg_buf)
 		dpkg_set_field(extr->extract_type, EXTRACT_TYPE,
 			       cfg->extracts[i].type);
 
-		for (j = 0; j < DPKG_NUM_OF_MASKS; j++) {
+		for (j = 0; j < extr->num_of_byte_masks; j++) {
 			extr->masks[j].mask = cfg->extracts[i].masks[j].mask;
 			extr->masks[j].offset =
 				cfg->extracts[i].masks[j].offset;
diff --git a/drivers/net/dpaa2/mc/dpni.c b/drivers/net/dpaa2/mc/dpni.c
index 362cd476f..b74a1a317 100644
--- a/drivers/net/dpaa2/mc/dpni.c
+++ b/drivers/net/dpaa2/mc/dpni.c
@@ -1803,10 +1803,13 @@ int dpni_set_congestion_notification(struct fsl_mc_io *mc_io,
 	cmd_params->qtype = qtype;
 	cmd_params->tc = tc_id;
 	cmd_params->congestion_point = cfg->cg_point;
-	cmd_params->cgid = (uint8_t)cfg->cgid;
-	cmd_params->dest_id = cpu_to_le32(cfg->dest_cfg.dest_id);
+	if (cfg->cg_point == DPNI_CP_CONGESTION_GROUP)
+		cmd_params->cgid = (uint8_t)cfg->cgid;
+	if (cfg->dest_cfg.dest_type != DPNI_DEST_NONE) {
+		cmd_params->dest_id = cpu_to_le32(cfg->dest_cfg.dest_id);
+		cmd_params->dest_priority = cfg->dest_cfg.priority;
+	}
 	cmd_params->notification_mode = cpu_to_le16(cfg->notification_mode);
-	cmd_params->dest_priority = cfg->dest_cfg.priority;
 	cmd_params->message_iova = cpu_to_le64(cfg->message_iova);
 	cmd_params->message_ctx = cpu_to_le64(cfg->message_ctx);
 	cmd_params->threshold_entry = cpu_to_le32(cfg->threshold_entry);
-- 
2.17.1