From patchwork Wed Apr 19 19:55:32 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: 9688791 X-Patchwork-Delegate: sboyd@codeaurora.org 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 0AE2F602DC for ; Wed, 19 Apr 2017 19:55:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F0AB02787C for ; Wed, 19 Apr 2017 19:55:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E592F28429; Wed, 19 Apr 2017 19:55:40 +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=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 738DC2787C for ; Wed, 19 Apr 2017 19:55:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935986AbdDSTzj (ORCPT ); Wed, 19 Apr 2017 15:55:39 -0400 Received: from mout.web.de ([212.227.15.4]:57424 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935832AbdDSTzi (ORCPT ); Wed, 19 Apr 2017 15:55:38 -0400 Received: from [192.168.1.2] ([77.182.113.86]) by smtp.web.de (mrweb003 [213.165.67.108]) with ESMTPSA (Nemesis) id 0MKrOS-1d0vhN1Fuy-0005Au; Wed, 19 Apr 2017 21:55:33 +0200 Subject: [PATCH 3/5] clk: mvebu: Use kcalloc() in two functions From: SF Markus Elfring To: linux-clk@vger.kernel.org, Michael Turquette , Stephen Boyd Cc: LKML , kernel-janitors@vger.kernel.org References: <8af5ccb0-f7c1-297c-2661-8ced61302c37@users.sourceforge.net> Message-ID: <6d6837ee-ea98-00cc-faea-cfa2a556109b@users.sourceforge.net> Date: Wed, 19 Apr 2017 21:55:32 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.0 MIME-Version: 1.0 In-Reply-To: <8af5ccb0-f7c1-297c-2661-8ced61302c37@users.sourceforge.net> Content-Language: en-GB X-Provags-ID: V03:K0:Wk8xwpM0SvALnrcGTcuduhaJ9cmzg5BZg2jvnjt8//U1/exiTeM HlpNJFp+csX3A47eyTjll4/HebO0JtbCYA5kS2w5tB7TX1vEE7H7rdLwCfoDK3GbTb5bTSn 9eh3e7wckk402GOqB+DrZ5VTe3DtGbRz6ALxdo6h79CCh058Rufzdt5Kdb0gg9FkebQR6Dd +xsAQJ7W8GUZpVzAw8X0g== X-UI-Out-Filterresults: notjunk:1; V01:K0:Yt2p+vtPta8=:2vR+8JtJya572UfBrfkeEy xLeA77YzHzPk4ZMsY7zezGqxT4VgamYPL2XwzB2HFftk420gO9ZbRrxUoTEduIDAd48YEDqKO lnERuC3ZkhMyDgDpffSYoqBf11fgA1skKkdQD+RW0bRYuMO1g7gVxyR+yq1SGRe1D/jVncAEy O6Un5AbkwhOcnMX7YffVw8uz0TZTvGrzFmH57MjxtApAwUmozmCS7v/5EB7w5p9B0YPs6o8hk R2JvT/M6fy1XvYBL10ab7HpPfBU5FK7YsRz4i7wfglA1LJvh1Ab1KvbNHd7t7eC6DNt/clz1c gfnHl9uS6Ho680uoVZeE6KxP7iURZNZSZgqQfCsfkGgYy+gT3tPIlrZuof9mOcDXD4BJVRIWH xnj3WIaRRniCiERJa7YKnnI0mfQAuMScCrs+KAibLg2M69iaUtgq9wkUjUUHUMQJuXM1NYnIA pLP9M0VX2mQGV8m4Dd9fsHhVVZDs4PuUiSlU6FsR3w6Irxed5rrahYdOj2reqenLhgMGMzhSZ BLw2mayGBqrUJxIbVspsH1zlqpZBIruAK4HQmSkXlNUCKKveqM8AbNM7NSS2+vt5UTRNO7RDL 6Nb//2oYpYbDTIRU+0SyIqhVHbtF+pKt9f6iThhPELD6/P7aejHW/O6TB5+Go4e1jjIEHhfBF zCC+Iben3swujeG36fq02biRLRkHwsamX+0AyzQHAyiwQwOwaplgPIrmCukxEAtI2WSxEJ1Oy nDZjQHAWI1EKnRdx/zi3j3VJ7phluNoLjqqhk+k9LWTMhPxBUanbCIz8Zd9JsOxAw0Fq2Oqfm ETYN0hR Sender: linux-clk-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-clk@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Markus Elfring Date: Wed, 19 Apr 2017 21:08:54 +0200 * Multiplications for the size determination of memory allocations indicated that array data structures should be processed. Thus use the corresponding function "kcalloc". This issue was detected by using the Coccinelle software. * Replace the specification of data types by pointer dereferences to make the corresponding size determination a bit safer according to the Linux coding style convention. Signed-off-by: Markus Elfring --- drivers/clk/mvebu/common.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/clk/mvebu/common.c b/drivers/clk/mvebu/common.c index 66be2e0c82b4..472c88b90256 100644 --- a/drivers/clk/mvebu/common.c +++ b/drivers/clk/mvebu/common.c @@ -126,7 +126,7 @@ void __init mvebu_coreclk_setup(struct device_node *np, if (desc->get_refclk_freq) clk_data.clk_num += 1; - clk_data.clks = kzalloc(clk_data.clk_num * sizeof(struct clk *), + clk_data.clks = kcalloc(clk_data.clk_num, sizeof(*clk_data.clks), GFP_KERNEL); if (WARN_ON(!clk_data.clks)) { iounmap(base); @@ -270,7 +270,7 @@ void __init mvebu_clk_gating_setup(struct device_node *np, n++; ctrl->num_gates = n; - ctrl->gates = kzalloc(ctrl->num_gates * sizeof(struct clk *), + ctrl->gates = kcalloc(ctrl->num_gates, sizeof(*ctrl->gates), GFP_KERNEL); if (WARN_ON(!ctrl->gates)) goto gates_out;