Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S939032AbdDSTzm (ORCPT ); Wed, 19 Apr 2017 15:55:42 -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 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-Type: text/plain; charset=utf-8 Content-Language: en-GB Content-Transfer-Encoding: 7bit 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-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1492 Lines: 42 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; -- 2.12.2