From patchwork Wed Apr 26 16:52:19 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SF Markus Elfring X-Patchwork-Id: 9701731 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 3168260245 for ; Wed, 26 Apr 2017 16:53:09 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 21A7228619 for ; Wed, 26 Apr 2017 16:53:09 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1617A2861B; Wed, 26 Apr 2017 16:53:09 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id C93C528619 for ; Wed, 26 Apr 2017 16:53:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Date:Message-ID:Subject: From:To:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=tNPPnCjVr8Jmo74Pw64jTBPZDso88sVrk2sYF3em95A=; b=djArxd+MXZWFxQ CdvUbz9n+F6Zgh7tp+5foo7Jh7k/e/A1r5909ptEdkmnE8ocpOZe4KSn8TEcqWZP+AAVKQxTmXiKq oxk9nVsCzcofyRVFSfq1zNeiIUK8bJlSD1ZlyTiOKeV9T37JCgdSkqord+6GyGwMTLOsu5xgOlOFM 9YyKYTtkoqYaCIIQ///BZ3v+xzjHZcEeNC/j+Ha5jmQsIIG3g7pMS42HpaE1SlN5coO+EerRtugRx Rf1f+Bq0a9I2ckoz36ux7S8/ELOQkglyJjanzOoNQ8e7q8+nwb2HdQgocXCNVF1HlTvla52nhxYSL dWfb05DHzCKB/FAINxRg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1d3QBc-0006BO-GG; Wed, 26 Apr 2017 16:53:04 +0000 Received: from mout.web.de ([212.227.17.12]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1d3QBX-00068o-Qo; Wed, 26 Apr 2017 16:53:01 +0000 Received: from [192.168.1.2] ([77.182.112.5]) by smtp.web.de (mrweb101 [213.165.67.124]) with ESMTPSA (Nemesis) id 0MDxKd-1dKmKo3WWN-00HRf1; Wed, 26 Apr 2017 18:52:22 +0200 To: linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, James Liao , Kevin Hilman , Matthias Brugger , Sascha Hauer , Shunli Wang From: SF Markus Elfring Subject: [PATCH] soc: mediatek: Use devm_kcalloc() in init_scp() Message-ID: Date: Wed, 26 Apr 2017 18:52:19 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.0.1 MIME-Version: 1.0 Content-Language: en-GB X-Provags-ID: V03:K0:AEUlDX+8pS/5IijfbpstVISpZ6/dVHggtT/YOOv0jyfFdyFN+fm wPoO6huqbwMn/XzH2OIRgnYm5tFQjJ0gyIHpn0PokEIuhEgbsDI8ifDSi9nRaFoIT1r/Z/i D6GLyWahvXfA5fmoHYVX0w7elMq9Ge7+7vdOajsSjLFkUIgKIuywLEJEx5Q93+02u60RJsI vj/ptFTtNFVI99omK/+hg== X-UI-Out-Filterresults: notjunk:1; V01:K0:gK/+PvWenxA=:rDqKJODanCxYWBF4Y7B5GN J+ZUEm3Ye7L4PfvWfdh8aWmack+Zdp+htNGOULcbzjf1euwy0oltJeeFyBbnQhYlo10GWgw/h xzNmrojw8ZNRGf/YBYmaJqtBhBp89qSOP197O9wCGybA0k4QMAQutHdTgD8L5i4m7/dUlHxs2 TleE5EDGwlqnY64dEkmPtM7W6tghOabAlx34W/64zaWHbu12rOd2aqPsn0+ytp0EcSLvi/XAq LFnbgKXCnHxQuV3rHX+Eo2EhWt/BRtGobhx4r23GznXu9cTxQO/DP6OanIYqjlagG6k7wBq1i TLMsQnbAykeSZIVfWseYPIiwq5eSWE4yag8M5kssXJ/P5+WoQZRqHrW6eBnawoHqF58Bgeew2 PKoFR4P36nt7CCulLhZtJPHs80ZbLuFfvX58TkLdsL+xMJX98pLm5fntPjgz8osoMQVU5hXt9 pLeP2YSbFJQuiW3dHl/gA6rF1Dbxux1Ilotz49eX60WrQv+GMsgbbabYPU/f45kkXGr3CCy9R I/0Lk4UOfnV01L76DK8Mbe01Vs8AhKMMeIXRh7M3RFrlpZwMlN6YssdCjNBSr3Vudoz77Dx99 Nt82cFZmn+A7p/sVXUoet+sSTBzFdBK6CQR1Wp6DbWv2Q83fVhBakUOt1rwPyZu05kY4IXfDb 9gqW7B/3ZiJfogyJiE+PpVxOfnjiinAtj05VimZeunlttGOtOivoUbLrRqa/RXDIFLz87MYK/ 6m/V77NQmqmy1K8/K1DkzKmEB5cJdZaXtNv2Vx0fJSbhwIpRPDBakNjjz+Yov0h2ZH+Esz5OD E47/pxs X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170426_095300_198363_B4F7870D X-CRM114-Status: UNSURE ( 7.78 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kernel-janitors@vger.kernel.org, LKML Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Markus Elfring Date: Wed, 26 Apr 2017 18:33:15 +0200 Multiplications for the size determination of memory allocations indicated that array data structures should be processed. Thus use the corresponding function "devm_kcalloc". This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring --- drivers/soc/mediatek/mtk-scpsys.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/soc/mediatek/mtk-scpsys.c b/drivers/soc/mediatek/mtk-scpsys.c index beb79162369a..9abf2b067ec6 100644 --- a/drivers/soc/mediatek/mtk-scpsys.c +++ b/drivers/soc/mediatek/mtk-scpsys.c @@ -365,15 +365,14 @@ static struct scp *init_scp(struct platform_device *pdev, if (IS_ERR(scp->base)) return ERR_CAST(scp->base); - scp->domains = devm_kzalloc(&pdev->dev, - sizeof(*scp->domains) * num, GFP_KERNEL); + scp->domains = devm_kcalloc(&pdev->dev, num, sizeof(*scp->domains), + GFP_KERNEL); if (!scp->domains) return ERR_PTR(-ENOMEM); pd_data = &scp->pd_data; - - pd_data->domains = devm_kzalloc(&pdev->dev, - sizeof(*pd_data->domains) * num, GFP_KERNEL); + pd_data->domains = devm_kcalloc(&pdev->dev, num, + sizeof(*pd_data->domains), GFP_KERNEL); if (!pd_data->domains) return ERR_PTR(-ENOMEM);