From patchwork Mon May 12 22:30:14 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergei Shtylyov X-Patchwork-Id: 4161111 Return-Path: X-Original-To: patchwork-linux-sh@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 507349F1C0 for ; Mon, 12 May 2014 22:30:20 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 83463202B4 for ; Mon, 12 May 2014 22:30:19 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 89E4220204 for ; Mon, 12 May 2014 22:30:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752235AbaELWaS (ORCPT ); Mon, 12 May 2014 18:30:18 -0400 Received: from mail-la0-f50.google.com ([209.85.215.50]:51173 "EHLO mail-la0-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751100AbaELWaR (ORCPT ); Mon, 12 May 2014 18:30:17 -0400 Received: by mail-la0-f50.google.com with SMTP id b8so2483594lan.9 for ; Mon, 12 May 2014 15:30:15 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:to:subject:cc:from:organization:date :mime-version:content-type:content-transfer-encoding:message-id; bh=ChrqLG25eBKOOc4wuZu52FPSITRZH4xK79nqJM9A5yw=; b=iaVHMU69cmZqdVdTedOV1/9+6inMEhoIsSGcrmHbO+GqZ8C6UlqKFlTLV4y2lKN/IZ I3595zBYq8waObq3h/SduhZ843mpIY6eh9FbMVGestR44sULJ48RBHMQqLIcQ+iMXPrd sJu3L/+LLJBvY6BqwzzeeHLzzpzgvm/etFN9USlLBEEm5R0WdD1MC4WZRZhroumkATcg kzKmf60oHunJcyZCRx/nbrOWrVT5RBJHAW9XTxbajfgSY3cOrtBqN/AL6bRWmN8otJbc kKerrCN8vkU/WucqdzEOTiyI1C/G3gbMc/9wAX7/JbMsX+DO3qh6fenkw+v3sL9baxZa 6g5w== X-Gm-Message-State: ALoCoQki0OkthIjXiIMSKAcZY4JJQwlm7IHlDyediY6RBrRbF9h3xDGzkrI+NYO/t4FJJFMByUGs X-Received: by 10.112.4.106 with SMTP id j10mr26115318lbj.7.1399933815369; Mon, 12 May 2014 15:30:15 -0700 (PDT) Received: from wasted.cogentembedded.com (ppp83-237-58-251.pppoe.mtu-net.ru. [83.237.58.251]) by mx.google.com with ESMTPSA id sz5sm15014265lbb.33.2014.05.12.15.30.14 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 12 May 2014 15:30:14 -0700 (PDT) To: netdev@vger.kernel.org Subject: [PATCH v2] sh_eth: replace devm_kzalloc() with devm_kmalloc_array() Cc: linux-sh@vger.kernel.org From: Sergei Shtylyov Organization: Cogent Embedded Date: Tue, 13 May 2014 02:30:14 +0400 MIME-Version: 1.0 Message-Id: <201405130230.14743.sergei.shtylyov@cogentembedded.com> Sender: linux-sh-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sh@vger.kernel.org X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP When I was converting the driver to the managed device API, only devm_kzalloc() was available for memory allocation, so I had to use it, despite zeroing out the PHY IRQ array right before initializing all its entries to PHY_POLL was quite stupid. Now that devm_kmalloc_array() has become available, we can avoid the needless zeroing out... Signed-off-by: Sergei Shtylyov --- This patch is against DaveM's 'net-next.git' repo. Changes in version 2: - switched to calling devm_kmalloc_array(). drivers/net/ethernet/renesas/sh_eth.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-sh" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Index: renesas/drivers/net/ethernet/renesas/sh_eth.c =================================================================== --- renesas.orig/drivers/net/ethernet/renesas/sh_eth.c +++ renesas/drivers/net/ethernet/renesas/sh_eth.c @@ -2627,8 +2627,8 @@ static int sh_mdio_init(struct sh_eth_pr pdev->name, pdev->id); /* PHY IRQ */ - mdp->mii_bus->irq = devm_kzalloc(dev, sizeof(int) * PHY_MAX_ADDR, - GFP_KERNEL); + mdp->mii_bus->irq = devm_kmalloc_array(dev, PHY_MAX_ADDR, sizeof(int), + GFP_KERNEL); if (!mdp->mii_bus->irq) { ret = -ENOMEM; goto out_free_bus;