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 AA91CA0560; Tue, 18 Oct 2022 21:47:25 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id DCC8E4161A; Tue, 18 Oct 2022 21:47:23 +0200 (CEST) Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2080.outbound.protection.outlook.com [40.107.93.80]) by mails.dpdk.org (Postfix) with ESMTP id 052F542B79 for ; Tue, 18 Oct 2022 21:47:22 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=nA5b4y6Wa5n5pDd0TC31LA9RnhyX+DLydE3jV7yFrp3adRv4odkyeDU3qdaHAvbQvhIzpwLPSUIGBtqqJy436qJ7A4j/Kp0SRJleVEA6WREBWhlj5Af1FKNEkVGLdGYl/1Ne/6GtLHAEblXbaXjSluXVOlJjk8u6sT+em/E5RB/J0IDeA43fajgOs/uLPG8mUo6M6/JJiUc0VGMLqsZZ8pp1t/RerXCF7z2h9vZyLhAUnI+fmKX5tkZeM+aE6u1CPZS3r5gULDSppfKH+3XONkFvVMyKpS6EO9vi2pPk6k9aXZQ55FrXiV3vew9njgYEcsb+OFTDJvSGgwF/gJT5Hg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=Eu4ZZSERRaayfdNVuWwa9lBa02MugG01U7DOYZG7DD0=; b=cj2JU2e9pHJvGq1Wp+i3L4oVPfXuX0KAilcZpW3qrx59zNzNwJe3aOfqFxuy3Zz9nfFlZ6goJnPii1UWK9XEkU+SHdUngOWiqetUQqVKgYIgN98niXTfrAaczVoHfbfU+Pt1camA40BMB7Oi3qP4TFrA7OY32oiuvtJv93ZkEWs7QGycroZsuNgyAJGfH1ay8zluZ5W72vrqR1T4h9i6Mp7p2hDVD+r4fRo+NsTb0nHnb5vcG62PXiypQJRBIZsc3ijlWCu2NYmvtv75nVhuPIyLGFFeujjKjAaMtctGTBqJQsLGj1vHLfLSt87cd5G14uplnx0kE13wihPUmYMqVQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=dpdk.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Eu4ZZSERRaayfdNVuWwa9lBa02MugG01U7DOYZG7DD0=; b=jt2yQdMWAMf9Z4Z9nXADhFwk4ECN/2gwf6N69SZvT1nniBH7uO4R5TFjdZQF3Z5qqXx9PnrQZ47Rxch1gmLLFG5tvxJlt+ULE/y3I8gg2VhJSw+4j4IY2rl5mvf64ScXLEskVc1g9sgsNu9tc19Mk0fKeti9yxgvOGvB6QItq84= Received: from DS7PR05CA0095.namprd05.prod.outlook.com (2603:10b6:8:56::29) by MN0PR12MB6247.namprd12.prod.outlook.com (2603:10b6:208:3c1::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5723.32; Tue, 18 Oct 2022 19:47:20 +0000 Received: from DM6NAM11FT115.eop-nam11.prod.protection.outlook.com (2603:10b6:8:56:cafe::b9) by DS7PR05CA0095.outlook.office365.com (2603:10b6:8:56::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5746.11 via Frontend Transport; Tue, 18 Oct 2022 19:47:19 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by DM6NAM11FT115.mail.protection.outlook.com (10.13.173.33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5746.16 via Frontend Transport; Tue, 18 Oct 2022 19:47:19 +0000 Received: from driver-dev1.pensando.io (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Tue, 18 Oct 2022 14:47:18 -0500 From: Andrew Boyer To: CC: Andrew Boyer Subject: [PATCH v2 30/36] net/ionic: update array allocations to use calloc Date: Tue, 18 Oct 2022 12:41:25 -0700 Message-ID: <20221018194131.23006-31-andrew.boyer@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20221011005032.47584-1-andrew.boyer@amd.com> References: <20221011005032.47584-1-andrew.boyer@amd.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6NAM11FT115:EE_|MN0PR12MB6247:EE_ X-MS-Office365-Filtering-Correlation-Id: 415e0fc1-e382-482b-ca84-08dab1419172 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: qM9TyvwW71sR81jcWy0XAy9Wek+463kFtRXeFIPmjFrJlfrRuTg0LcRlBRt88a4H6amy57uN4rJ1ab99Y+fhfsz9wQTD6IvN5iJnL1pp+dD932Us4iSnkXq7ofOUtE1NwnjKEo5QmkvgKkXToT3zB4ehMyWEgcnCFPDymWNzK5c2A0OOr+cYYgyRlpVlmhsiazX35b5NYOl+TJAMSflUjiCIwbMvH9VTDE8DG5Gy/uGzNQV15+fJQox+qJuchgSOoRw6q9+KEICJNGJAZqppAiGyLVMhPEeyN/JV65Ldwssa44Ja7N2KxFh3dsOLPNJYQIeQVgExUd1QdI03IWOs/dfl799UyKH5BRsswA9wrAXctLMFXHz2CFWI7dQb+m8uoskD35gGPUE+zGahlH5FKo2WfrT1/ys8cUOTMA3eFH4WQhWUZyz4YBQWZlZGvtVtls0h7f2r2r0VkeKwbvkqGcwsBMNbcuTy0Mk1x8/58poCV4ulkoPMljynwxizBL386RjlNcd4rW2I2BzpqIuskDa0+12QzDoEbUbjygnGEGO/LY1NfIrw21695yjpYeC9cCYldUSqscb6vkc3VzWHOVSX+X9vf19oyLxFaZsetHzg59Y9gaUJf36pkDmgZ3Ox94vfwLlPjf+LQ54q/LzYowndvZsZUSbReRJDVrdTe6wca13SmuZXdl8a7EmKzDjul+Jf8O4+wtA6hs2GWYd2qBm6vuO9EH6n3kAn31FVv1mnoLw4PD5xj88SllZQsg0E4AehFcbK7Wj3X+jxxaBWNugqZSizBFdU2L4c43+6WAFT0jz1ITAKw8qx+2ZUfaP/ X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230022)(4636009)(346002)(39860400002)(136003)(376002)(396003)(451199015)(36840700001)(40470700004)(46966006)(6916009)(44832011)(8676002)(316002)(4326008)(26005)(41300700001)(186003)(2906002)(1076003)(336012)(5660300002)(2616005)(478600001)(16526019)(8936002)(81166007)(36756003)(82740400003)(356005)(82310400005)(426003)(47076005)(36860700001)(6666004)(83380400001)(70586007)(70206006)(86362001)(40460700003)(40480700001)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Oct 2022 19:47:19.6931 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 415e0fc1-e382-482b-ca84-08dab1419172 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT115.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN0PR12MB6247 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 Use rte_calloc() where appropriate. This makes the code clearer. Signed-off-by: Andrew Boyer --- drivers/net/ionic/ionic_ethdev.c | 6 +++--- drivers/net/ionic/ionic_lif.c | 12 ++++++------ 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/drivers/net/ionic/ionic_ethdev.c b/drivers/net/ionic/ionic_ethdev.c index 0184ffb02e..b1d8663329 100644 --- a/drivers/net/ionic/ionic_ethdev.c +++ b/drivers/net/ionic/ionic_ethdev.c @@ -1003,9 +1003,9 @@ eth_ionic_dev_init(struct rte_eth_dev *eth_dev, void *init_params) adapter->max_mac_addrs); /* Allocate memory for storing MAC addresses */ - eth_dev->data->mac_addrs = rte_zmalloc("ionic", - RTE_ETHER_ADDR_LEN * adapter->max_mac_addrs, 0); - + eth_dev->data->mac_addrs = rte_calloc("ionic", + adapter->max_mac_addrs, + RTE_ETHER_ADDR_LEN, 0); if (eth_dev->data->mac_addrs == NULL) { IONIC_PRINT(ERR, "Failed to allocate %u bytes needed to " "store MAC addresses", diff --git a/drivers/net/ionic/ionic_lif.c b/drivers/net/ionic/ionic_lif.c index db0893acb8..8b10b26266 100644 --- a/drivers/net/ionic/ionic_lif.c +++ b/drivers/net/ionic/ionic_lif.c @@ -1037,17 +1037,17 @@ ionic_lif_alloc(struct ionic_lif *lif) return -ENOMEM; } - lif->txqcqs = rte_zmalloc("ionic", sizeof(*lif->txqcqs) * - adapter->max_ntxqs_per_lif, 0); - + lif->txqcqs = rte_calloc("ionic", + adapter->max_ntxqs_per_lif, + sizeof(*lif->txqcqs), 0); if (!lif->txqcqs) { IONIC_PRINT(ERR, "Cannot allocate tx queues array"); return -ENOMEM; } - lif->rxqcqs = rte_zmalloc("ionic", sizeof(*lif->rxqcqs) * - adapter->max_nrxqs_per_lif, 0); - + lif->rxqcqs = rte_calloc("ionic", + adapter->max_nrxqs_per_lif, + sizeof(*lif->rxqcqs), 0); if (!lif->rxqcqs) { IONIC_PRINT(ERR, "Cannot allocate rx queues array"); return -ENOMEM; -- 2.17.1