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 5FA2241EB5; Thu, 16 Mar 2023 22:29:55 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id BD19642F94; Thu, 16 Mar 2023 22:29:43 +0100 (CET) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by mails.dpdk.org (Postfix) with ESMTP id BB32E40DF6 for ; Thu, 16 Mar 2023 22:29:38 +0100 (CET) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 32GG041R005830 for ; Thu, 16 Mar 2023 14:29:38 -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; s=pfpt0220; bh=fVjgHnfDyDIPGKRXgWmzZTbM1pTyWP8cfO/5rB1Dnr4=; b=Gs3gJ7G2EZX/fqnNT3Apb0WIG4WVlVgOhF9WJbGG9x8YrE90yvqcEwOyZ1dw3BQm/Mbu 8YwvFsnTgo0C80P6XCNlB4EiuW1vXnQqFSvRGaLq8DvPS1noPZgPGI9CxuWftF5F3ANE /lkAENEo/T/o4tW4U3QA2opeDNwk9I3y2cVgdGzTNY0NPnXPkew0Mb5+b39Ko+/gdDMB jYN0pMPkZoheV4MagYjyi/pENVt4THYyf2HzaWeiXGxjAJczo2lC6l6l3Iqz41Wadh1N qbGZTe0HgTU9YqOknG+3s9eiF/tc+IEoZR1oOHw3Z7lfHozhhCblUUP7WVJ6OIkhg+4R iw== Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3pbxq2ucrj-3 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Thu, 16 Mar 2023 14:29:37 -0700 Received: from DC5-EXCH01.marvell.com (10.69.176.38) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server (TLS) id 15.0.1497.42; Thu, 16 Mar 2023 14:29:36 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server id 15.0.1497.42 via Frontend Transport; Thu, 16 Mar 2023 14:29:36 -0700 Received: from ml-host-33.caveonetworks.com (unknown [10.110.143.233]) by maili.marvell.com (Postfix) with ESMTP id 578DB3F707A; Thu, 16 Mar 2023 14:29:36 -0700 (PDT) From: Srikanth Yalavarthi To: Srikanth Yalavarthi , Prince Takkar CC: , , , Subject: [PATCH v3 7/8] ml/cnxk: avoid variable name reuse in a function Date: Thu, 16 Mar 2023 14:29:03 -0700 Message-ID: <20230316212904.9318-8-syalavarthi@marvell.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230316212904.9318-1-syalavarthi@marvell.com> References: <20230315135427.11489-1-syalavarthi@marvell.com> <20230316212904.9318-1-syalavarthi@marvell.com> MIME-Version: 1.0 Content-Type: text/plain X-Proofpoint-GUID: rHZHchz7cLQC2Kjk5O0EeShmaVuCCN2D X-Proofpoint-ORIG-GUID: rHZHchz7cLQC2Kjk5O0EeShmaVuCCN2D X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-03-16_14,2023-03-16_02,2023-02-09_01 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 Avoid reusing variable name in different scopes with in same function. Move variable declarations to beginning of function. Fixes: b7d0650ebce0 ("ml/cnxk: reserve and free OCM pages") Signed-off-by: Srikanth Yalavarthi --- drivers/ml/cnxk/cn10k_ml_ocm.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/drivers/ml/cnxk/cn10k_ml_ocm.c b/drivers/ml/cnxk/cn10k_ml_ocm.c index 2367f40a1d..93505c9c09 100644 --- a/drivers/ml/cnxk/cn10k_ml_ocm.c +++ b/drivers/ml/cnxk/cn10k_ml_ocm.c @@ -390,6 +390,7 @@ cn10k_ml_ocm_reserve_pages(struct rte_ml_dev *dev, uint16_t model_id, uint64_t t void cn10k_ml_ocm_free_pages(struct rte_ml_dev *dev, uint16_t model_id) { + struct cn10k_ml_model *local_model; struct cn10k_ml_model *model; struct cn10k_ml_dev *mldev; struct cn10k_ml_ocm *ocm; @@ -420,17 +421,15 @@ cn10k_ml_ocm_free_pages(struct rte_ml_dev *dev, uint16_t model_id) if (wb_page_end == ocm->tile_ocm_info[tile_id].last_wb_page) ocm->tile_ocm_info[tile_id].last_wb_page = wb_page_start - 1; - /* Update scratch page size and clear extra bits */ - scratch_resize_pages = 0; /* Get max scratch pages required, excluding the current model */ + scratch_resize_pages = 0; for (i = 0; i < dev->data->nb_models; i++) { - struct cn10k_ml_model *model = dev->data->models[i]; - - if ((i != model_id) && (model != NULL)) { - if (IS_BIT_SET(model->model_mem_map.tilemask, tile_id)) - scratch_resize_pages = - PLT_MAX((int)model->model_mem_map.scratch_pages, - scratch_resize_pages); + local_model = dev->data->models[i]; + if ((i != model_id) && (local_model != NULL)) { + if (IS_BIT_SET(local_model->model_mem_map.tilemask, tile_id)) + scratch_resize_pages = PLT_MAX( + (int)local_model->model_mem_map.scratch_pages, + scratch_resize_pages); } } -- 2.17.1