From patchwork Fri Oct 7 17:43:30 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Boyer X-Patchwork-Id: 117610 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 7DCF1A04FD; Fri, 7 Oct 2022 19:47:47 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 12C9D40DFB; Fri, 7 Oct 2022 19:45:13 +0200 (CEST) Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2057.outbound.protection.outlook.com [40.107.92.57]) by mails.dpdk.org (Postfix) with ESMTP id 4C7B742BDA for ; Fri, 7 Oct 2022 19:45:09 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=oUN2qSCg+xQGmUkikNl+a+aownaTiqoFht3eAZvBxvJPWF7wQk+Z3DeZ01iygGVKqcWADwU43tza3IUQIoEtkZ0Rqg2gSbggimpwBj+8ZX2azwAV4Apt1tvmOxem+Oizj/K6FcRdOcOqFU3Oi4iv3ECeHTbqCGEytKFNf7G9dLzvT7DIf11Ww3WHXdsIDOY0/hjxKYrHB8jYA0lvvcDAdre30sKddEYzVx2PYXvc0Z/W7wLvPHuo9Ghyk3LZhk/y4DgiBmUv8H4Wka7prkSrRlucQ4ESo9WlXIC+16moOVhp7MAA1JwtwVo6xd6+EpvUdnTCkPIS5lXZXFkcdDetgQ== 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=uyKiizAlAuKHt75h1rAq4qKYa0RquoHsmzrSSa+9dds=; b=RBkUfqIWu6/ytyfImYboB17e8MwjE683c4Jaru3IdIqgHu2mfj1CWO5AB42V9B9txOjhiM0UaDja9ubh/DC5v8ta+wiGb32jxDpu6gbjI7dgleBSd4gQZzB0ukoBc87x8EQGJOgyHx2clmIBMxDxU1uniZP2JHZDP3iOcF1eEczT7Scir+2K71XpkglDuogamWsHUQ3Ww8yx91pYbRv5pEpwxgwNerp3BNl1I43UCKry9pXg2I9IAzokpC8YT7IDXWW53GEQXzTdC/3Xa6y60UndUhOd1iT43JPgRqNHrJqe2Ch0I6iEfGYdA0a41BvdrXSHH5KtRliCfq7new3EGA== 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=uyKiizAlAuKHt75h1rAq4qKYa0RquoHsmzrSSa+9dds=; b=uEwytTTeqIA7SbKgY5a/4PSpR8jYVx32xGwjM9c3jOjvZhQ2lnn2RXbpW0Gcc3Bm6NYzsy2g1vgtwOKgBbhKFBAXsaXV1JzNtb+/IqTsW0WLfx2UIXayJlVySuDuWsWOP4nkKx72fiK+zgELVIOz0oGZP8jcWP/EBpbrw/41oWk= Received: from MW4PR03CA0350.namprd03.prod.outlook.com (2603:10b6:303:dc::25) by PH7PR12MB6468.namprd12.prod.outlook.com (2603:10b6:510:1f4::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5676.19; Fri, 7 Oct 2022 17:45:05 +0000 Received: from CO1NAM11FT068.eop-nam11.prod.protection.outlook.com (2603:10b6:303:dc:cafe::7) by MW4PR03CA0350.outlook.office365.com (2603:10b6:303:dc::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5709.15 via Frontend Transport; Fri, 7 Oct 2022 17:45:05 +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 CO1NAM11FT068.mail.protection.outlook.com (10.13.175.142) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5709.10 via Frontend Transport; Fri, 7 Oct 2022 17:45:05 +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.28; Fri, 7 Oct 2022 12:45:01 -0500 From: Andrew Boyer To: CC: Andrew Boyer Subject: [PATCH 29/35] net/ionic: update array allocations to use calloc Date: Fri, 7 Oct 2022 10:43:30 -0700 Message-ID: <20221007174336.54354-30-andrew.boyer@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20221007174336.54354-1-andrew.boyer@amd.com> References: <20221007174336.54354-1-andrew.boyer@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1NAM11FT068:EE_|PH7PR12MB6468:EE_ X-MS-Office365-Filtering-Correlation-Id: e944b738-14af-4223-3cf6-08daa88bab2a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: DpEPaqCm2CNBBsXEnwszguCWyMOmyXYp+0x00qAcq1CtocRLreZqioYzMCW8edxijR3DstmJ25eWO/HnmCxCdMjToKkB4BWAyMYbvSWgU56sb8HCKxRanimOkGTu4OW1gZyvlVF5+I8RnYnHzticRcNSuhJ4q1fa6OTQEZhti2xelI6UNcxFkeeD3/vEcgNRnQ4eVXQpt2TYIitCvBsx/C87nYgbdDPj/2WL//w6vv94m13++MQbLiMWwg92s1RPFtKl36f3Uq4uO4U+AdUKjZEHQFowPuCN/VeVbu95SwA/NvmZUpAji7fPrBWEO+ae/FhEkLqSnmZNm0re/XcNNrW8jFWwu1y0hbpCQdpg2hyqIvJVWrzX32n6T/RQEzAv+r5xvhHPwS8I8MF2ToZF0A42Rb6fJ+p58euUQl2/0DwFUmifD551N14/3nbTq96NwRVU2dzsyMOElu0H1Fki2XOMl3B1W1u7+WdgK5ppH//e1YTWq6dnz8G46G0M1gRWT+yvDkAGVn5tr6bsOhjfQjqXbrt5SF4jqfGh163m6fodRcS22XQGxpCt8mi8T8friAD8YXsjL/avuDRC9uE7o7TpINKpRABB6iFuZWij1ncgLR4xc4psVHLVcdOYPyquGjMioguJ1bdx/L9p7kplorget6wGvjud99pV2YobbDJoI7gpMgD/4ptv/qD/YMbBZswVYLMepxJwZWe8XKOtMDAkXX3B1PR0/BNvWIy0/cuobhN/nPwcb7kYMARWVrxwXCSkPCYb9y7WIsNZubce32XlmX/j9NZtwopguQV0wvXL+3bVeVDXgPaBM86vs1fC 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)(39860400002)(346002)(376002)(396003)(136003)(451199015)(46966006)(36840700001)(40470700004)(356005)(40480700001)(82310400005)(478600001)(40460700003)(41300700001)(8936002)(86362001)(8676002)(44832011)(6916009)(6666004)(83380400001)(2906002)(4326008)(36860700001)(316002)(5660300002)(81166007)(36756003)(186003)(426003)(26005)(47076005)(70586007)(1076003)(82740400003)(2616005)(336012)(16526019)(70206006)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Oct 2022 17:45:05.0220 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e944b738-14af-4223-3cf6-08daa88bab2a 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: CO1NAM11FT068.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB6468 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 a6e7c7fa9f..43fa5f8bbf 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 bb107b30e9..fbeec8ef2e 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;