From patchwork Sat Dec 5 19:17:40 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rasmus Villemoes X-Patchwork-Id: 338716 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.9 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, MSGID_FROM_MTA_HEADER, SPF_HELO_NONE, SPF_PASS, UNWANTED_LANGUAGE_BODY, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9FA1BC433FE for ; Sat, 5 Dec 2020 19:21:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7B2DF23122 for ; Sat, 5 Dec 2020 19:21:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727715AbgLETVV (ORCPT ); Sat, 5 Dec 2020 14:21:21 -0500 Received: from mail-am6eur05on2131.outbound.protection.outlook.com ([40.107.22.131]:50144 "EHLO EUR05-AM6-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727445AbgLETUl (ORCPT ); Sat, 5 Dec 2020 14:20:41 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dT4sLkbCqCotYnAnXT4zw1CaW9BSg7yPQxnJty/hK/oyCEAQjVNycfGQIz1cXUNwj/dXigrN4M5ZUYQs1T9NkO6faxmYj85JdX6I054V32TPX77GEjcBBoDNvFe3mwPNaWT6LQwVdqfxM68odLjpHrpcEYLXR40EzIdMjzwKvSjotJuShYJ+ZWupQloq0SCicZQpXgwekDjLhRHPQhuEDqth1Sr7h8gimGOqPpvyRuRLxkoCc89VFhaT1oH/5vVFlUipn2XWHc90aw7k7RBnaNB0OOKOjVEf51dU2Oke7d1uLkqdsc4PY71xukvlI5x/sF08tzG6THcCffjzF/DsuA== 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-SenderADCheck; bh=xZ4sPbbjyo9slA0ImQ87wTmVnC8Pn7/hnGEqYEL7IjY=; b=NsxhfMiEa7hTgMGfD0sk9W6mPPszJQO54Axt/X4t7kIa34DW5eVHXRioNuauuU2Zc7WAHXumg8apjvBauYYIjF3W+NFF4mL9VEPLRtZP/QTkuVk6ge+SSP/YOkUDRXIftdtmHYrrfJK0ZGLZF5GiXRc5GJ+AJbcJyF8g5TFql9VU1KEmX2ucVAMXcWluknteSimQv+D7GQRToV9o+wJrd9AUx85tMGDt92Gtye8PERPlB3t6radEQgvIxjCjZCBAVLzv//s6xloMMv2KcIijfZbi8iICY0BG7Scr2JWCPfiiuracgMX8Tj/b6X9ZnA6aYTzluIy05krZnVXWUBs7AA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=prevas.dk; dmarc=pass action=none header.from=prevas.dk; dkim=pass header.d=prevas.dk; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=prevas.dk; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=xZ4sPbbjyo9slA0ImQ87wTmVnC8Pn7/hnGEqYEL7IjY=; b=I+A0wtOdZUTSix1SDtHy+CVPxRH6XWAA4T74D5ZUca4tu3Z53z1fU45ve00UpqhJz3JL+JMsmMVd1BBdDgl6VLdU7bCXSCqjaIDQSNmRt0/JNcIDSe0RUqbQskDjt7GhVA/bb6lXRT5g1v8Xnpod41+aYVA18Gxfo30nMgPF1Cg= Authentication-Results: nxp.com; dkim=none (message not signed) header.d=none; nxp.com; dmarc=none action=none header.from=prevas.dk; Received: from AM0PR10MB1874.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:208:3f::10) by AM4PR1001MB1363.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:200:99::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3632.19; Sat, 5 Dec 2020 19:18:31 +0000 Received: from AM0PR10MB1874.EURPRD10.PROD.OUTLOOK.COM ([fe80::9068:c899:48f:a8e3]) by AM0PR10MB1874.EURPRD10.PROD.OUTLOOK.COM ([fe80::9068:c899:48f:a8e3%6]) with mapi id 15.20.3632.021; Sat, 5 Dec 2020 19:18:31 +0000 From: Rasmus Villemoes To: Li Yang , "David S. Miller" , Jakub Kicinski Cc: Zhao Qiang , Vladimir Oltean , Rasmus Villemoes , netdev@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org Subject: [PATCH 17/20] ethernet: ucc_geth: replace kmalloc_array()+for loop by kcalloc() Date: Sat, 5 Dec 2020 20:17:40 +0100 Message-Id: <20201205191744.7847-18-rasmus.villemoes@prevas.dk> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20201205191744.7847-1-rasmus.villemoes@prevas.dk> References: <20201205191744.7847-1-rasmus.villemoes@prevas.dk> X-Originating-IP: [5.186.115.188] X-ClientProxiedBy: AM5PR0701CA0063.eurprd07.prod.outlook.com (2603:10a6:203:2::25) To AM0PR10MB1874.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:208:3f::10) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from prevas-ravi.prevas.se (5.186.115.188) by AM5PR0701CA0063.eurprd07.prod.outlook.com (2603:10a6:203:2::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3654.5 via Frontend Transport; Sat, 5 Dec 2020 19:18:31 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 3ed4a984-a6d8-477f-401c-08d899528dbb X-MS-TrafficTypeDiagnostic: AM4PR1001MB1363: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:2958; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: i5SX06HBixAY9iOgPO9T0Ukfhl5JE4k57DEiH0fG5KQxKjkWY2flFl1xR7ap7ixdIusL/hvUp0k/ExvLd3KIqiNFJpB/xhKwioWg2Z0W1Ih7EhjlA2s7o8XxX8z5GnLWyrFJlISokO/gkB1mNsIXIvTtUJCP9C4pJD+1zR8rIssO0+T6x5+kUaST9ByA6np9M/V8VmPjVa0JY1i+hPZDQ3fYIEnXQ/+uNWN4RQWQ7mHHLo5OFxXZwf2/TmtxwDRXCrsvXLmuqfSE7I5IAATck/7ofFCAJWHlSrv9VVne9Bir0ofjY39AL7+dpwr13YSN7UbVBNA1+yIE91AqL4bJ0A== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM0PR10MB1874.EURPRD10.PROD.OUTLOOK.COM; PTR:; CAT:NONE; SFS:(396003)(39840400004)(346002)(136003)(366004)(376002)(2616005)(2906002)(8676002)(8936002)(83380400001)(52116002)(36756003)(66476007)(66946007)(66556008)(4326008)(8976002)(5660300002)(1076003)(6486002)(44832011)(6512007)(186003)(26005)(6666004)(110136005)(316002)(86362001)(478600001)(16526019)(54906003)(956004)(6506007); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: xr5enkF2jNltvO/n6qy5wAFaCiGJTTE4WfRIEetifIq2rpWYN7RrT69iby8VNZERGXeY+61hPtGIeXv1IPmMuBuCC4JUaIqs36s3Kv+0ZVKV+bmq/7wEYGT7T7u/dE8sjgySkHRlvt1gHbcuO9ORzqi2pzxvBWR0pdx9fGGFHddWwa/2vl6KPBRJFqaDRA1prlHAIFWTHOi9TFNq5kiHwDsJzG2Krj/uL6KzE6qyTaJjmNgTagH4rGW9/Y6VVpqeom4Extqcw3+7j6Q330aHaTxIUMuMuLAFRm5VD6wy9xDggY/IV1AILUwu5n4uBacuAqetYAyJfrOFRx6TDO/SdJGakNl6dFk6igP/CrHomv/3UbUQSG594elh72Fx/j6XMkAZcpCpqLt3+vckMnX8vqzaOO1UV0cy/h6dQxOfPE6L1endo2gd6xOAmFucJdvQ2jBMYdGytImPD/IwEaI4kmrLKp1iUFSoP9M90dHdXtAcqVm8bWOcB1PvjOnmSIFkONMs3URDSfeSnWZbhDznmT4+G5DvggvAKRviYoxoj961XeGi6smu1ymLNR63JTheeOZ4/YAvJ0ewCp819ZchWfSwdNL3s/IPrqWZhDyTA3RHoxaBb75F0DrerHlqW1eNvU0Z/qrQ7ysRxk1uOTnYsKwc+mfrNm/d96207Q/MhPMcekNbEEcq93mPGZ+h+63dVvyyM0NJMTArmqFntyIlZ7KUSfjQt0rVMARBsYk0zMQnG6q9yuUxJZaxFeS8deNcnzdU77t5scq3/aAUEPF/Is0mZvvicbrztI2/3NTLetFJEP29FfjYyPvYkeprPQ/wIew4bym+TEdhrvVIC6RAcjEPmH2Cb6YHHLZi8FGNZhHCaR/7N6/KrtdNLe9Jswqk7FRopvB+V1BMIrg/yyrU6ZYHIGz3dBM7UVLQkCffjIRE5ULVMTDxCO7LHGsHXnE4+s2h8CLmfNO7j/fcG23EMqcy43PJpnd4JUeCkP1LzH2tIX306+qu7m/8cCfZ+VTB X-OriginatorOrg: prevas.dk X-MS-Exchange-CrossTenant-Network-Message-Id: 3ed4a984-a6d8-477f-401c-08d899528dbb X-MS-Exchange-CrossTenant-AuthSource: AM0PR10MB1874.EURPRD10.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Dec 2020 19:18:31.8661 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: d350cf71-778d-4780-88f5-071a4cb1ed61 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: OcLdPfrTiX6Fm4b4Yo31GCT72wjApuSBfxzUl8bZ0px3OvaDxhcdaT0O8g/N6xkNYcqZ92XvHCpCbO47EG4CJ8/hiXYTMHyknFCaYJYBoFg= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM4PR1001MB1363 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Signed-off-by: Rasmus Villemoes --- drivers/net/ethernet/freescale/ucc_geth.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/drivers/net/ethernet/freescale/ucc_geth.c b/drivers/net/ethernet/freescale/ucc_geth.c index c9f619908561..3aebea191b52 100644 --- a/drivers/net/ethernet/freescale/ucc_geth.c +++ b/drivers/net/ethernet/freescale/ucc_geth.c @@ -2203,8 +2203,8 @@ static int ucc_geth_alloc_tx(struct ucc_geth_private *ugeth) for (j = 0; j < ug_info->numQueuesTx; j++) { /* Setup the skbuff rings */ ugeth->tx_skbuff[j] = - kmalloc_array(ugeth->ug_info->bdRingLenTx[j], - sizeof(struct sk_buff *), GFP_KERNEL); + kcalloc(ugeth->ug_info->bdRingLenTx[j], + sizeof(struct sk_buff *), GFP_KERNEL); if (ugeth->tx_skbuff[j] == NULL) { if (netif_msg_ifup(ugeth)) @@ -2212,9 +2212,6 @@ static int ucc_geth_alloc_tx(struct ucc_geth_private *ugeth) return -ENOMEM; } - for (i = 0; i < ugeth->ug_info->bdRingLenTx[j]; i++) - ugeth->tx_skbuff[j][i] = NULL; - ugeth->skb_curtx[j] = ugeth->skb_dirtytx[j] = 0; bd = ugeth->confBd[j] = ugeth->txBd[j] = ugeth->p_tx_bd_ring[j]; for (i = 0; i < ug_info->bdRingLenTx[j]; i++) { @@ -2266,8 +2263,8 @@ static int ucc_geth_alloc_rx(struct ucc_geth_private *ugeth) for (j = 0; j < ug_info->numQueuesRx; j++) { /* Setup the skbuff rings */ ugeth->rx_skbuff[j] = - kmalloc_array(ugeth->ug_info->bdRingLenRx[j], - sizeof(struct sk_buff *), GFP_KERNEL); + kcalloc(ugeth->ug_info->bdRingLenRx[j], + sizeof(struct sk_buff *), GFP_KERNEL); if (ugeth->rx_skbuff[j] == NULL) { if (netif_msg_ifup(ugeth)) @@ -2275,9 +2272,6 @@ static int ucc_geth_alloc_rx(struct ucc_geth_private *ugeth) return -ENOMEM; } - for (i = 0; i < ugeth->ug_info->bdRingLenRx[j]; i++) - ugeth->rx_skbuff[j][i] = NULL; - ugeth->skb_currx[j] = 0; bd = ugeth->rxBd[j] = ugeth->p_rx_bd_ring[j]; for (i = 0; i < ug_info->bdRingLenRx[j]; i++) {