From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 9853EA00BE; Tue, 29 Oct 2019 15:13:36 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id B59D51BF50; Tue, 29 Oct 2019 15:12:42 +0100 (CET) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by dpdk.org (Postfix) with ESMTP id 580D81BF40 for ; Tue, 29 Oct 2019 15:12:35 +0100 (CET) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id x9TE0SFh020533; Tue, 29 Oct 2019 07:12:34 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type : content-transfer-encoding; s=pfpt0818; bh=Z2cgfMjEqCcGfQV92FGoAD21eTY9cdegJoK0HUshULI=; b=QmLfuipF8+u1HWW46GKT00W474/LFDUYxOXjhRpZnzi31aLum4WJ0Z90LyKEb/dXdqHz JpHYmyYrASjgzoSWeQTfk/FrbF2w5/rWtJ8zcDzfbjcFAX9hV9ETR6PLSJsRor6E/GEk 38JJGtUvvZ4i35PMsU9iciE1V/dDi5zam+Mc8rf/ta7c+uE2JCPHF/7Ud5qEflHHbyH9 agaIvNzKeDJsrgHfEYsJRoYs283/Tb3XKaEbYfhx3o8kbZrSezmxPsqrmfwwKOqxTWGS gSrSNoPmCIVEPLfFdrO5OEfgu7VQPTXv5ByQOKN7vw9jfvUn6/OUVRgBTKBfBAo6gztL rA== Received: from sc-exch04.marvell.com ([199.233.58.184]) by mx0b-0016f401.pphosted.com with ESMTP id 2vvnnp1p3p-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Tue, 29 Oct 2019 07:12:34 -0700 Received: from SC-EXCH03.marvell.com (10.93.176.83) by SC-EXCH04.marvell.com (10.93.176.84) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Tue, 29 Oct 2019 07:12:33 -0700 Received: from maili.marvell.com (10.93.176.43) by SC-EXCH03.marvell.com (10.93.176.83) with Microsoft SMTP Server id 15.0.1367.3 via Frontend Transport; Tue, 29 Oct 2019 07:12:33 -0700 Received: from amok.marvell.com (unknown [10.95.130.126]) by maili.marvell.com (Postfix) with ESMTP id 7F9663F703F; Tue, 29 Oct 2019 07:12:31 -0700 (PDT) From: Andrzej Ostruszka To: , Hemant Agrawal , Sachin Saxena CC: , Date: Tue, 29 Oct 2019 15:12:08 +0100 Message-ID: <20191029141212.4907-9-aostruszka@marvell.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191029141212.4907-1-aostruszka@marvell.com> References: <20191028142145.3758-1-aostruszka@marvell.com> <20191029141212.4907-1-aostruszka@marvell.com> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.95,1.0.8 definitions=2019-10-29_04:2019-10-28,2019-10-29 signatures=0 Subject: [dpdk-dev] [PATCH v6 08/12] 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" This patch fixes 'maybe-uninitialized' warnings reported by compiler when using LTO. Compiler warning pointing to this error (with LTO enabled): error: ‘kg_cfg.extracts[0].masks[0].mask’ may be used uninitialized in this function [-Werror=maybe-uninitialized] extr->masks[j].mask = cfg->extracts[i].masks[j].mask; Fixes: 16bbc98a3e63 ("bus/fslmc: update MC to 10.3.x") Signed-off-by: Andrzej Ostruszka --- 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 16555d7b0..47a8bda6a 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 0950ee007..89a64b0ab 100644 --- a/drivers/net/dpaa2/mc/dpni.c +++ b/drivers/net/dpaa2/mc/dpni.c @@ -1839,10 +1839,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