Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757010AbdDRJiC (ORCPT ); Tue, 18 Apr 2017 05:38:02 -0400 Received: from mout.web.de ([212.227.15.3]:49258 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756013AbdDRJh7 (ORCPT ); Tue, 18 Apr 2017 05:37:59 -0400 Subject: [PATCH 1/6] clk: hisilicon: Use kcalloc() in hisi_clk_init() From: SF Markus Elfring To: linux-clk@vger.kernel.org, Jiancheng Xue , Michael Turquette , Stephen Boyd Cc: LKML , kernel-janitors@vger.kernel.org References: <7a649967-8ff1-8682-2f87-43871172fc28@users.sourceforge.net> Message-ID: <26e4342d-2292-adbf-5eb1-9ee172685498@users.sourceforge.net> Date: Tue, 18 Apr 2017 11:37:26 +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: <7a649967-8ff1-8682-2f87-43871172fc28@users.sourceforge.net> Content-Type: text/plain; charset=utf-8 Content-Language: en-GB Content-Transfer-Encoding: 7bit X-Provags-ID: V03:K0:wtOj/isNeirnu68Hy6Gv/QhTlGmImA3GYYR40q43b9nM1UKJmHE MYWEYLWWmq/VHJRwPprmd4XGry2gO/tYdMpJE/sSX6E1pJC6TARTcOG7dg0YBp5KUm9qXbO BE3iQkhtMRDS5fKm8Er25KWBvLoOZcT0IofUV3KsEs861B16uz0uVhep6U19KldIon677C8 vZAg35UbBy2TBExyqmu+w== X-UI-Out-Filterresults: notjunk:1;V01:K0:H3N3ixaEeLM=:zgOwQqyfP1Ya+lgH8xhwtK rqaBrXSQ7wPd206gv13Tfws3yNUYe6YkYNMYJV/yN3Sz4aw4/LWMAQMS/RnxB8n7Gd0CxzZQy vEaKFCzO7BOPyblBT3yBiCh2vz2SVPpoLMI5ZMoo5kPxo5Biq/qmVKnouIRBKLmd/9/YfIdmp sWZGEzAScd6Id4DBP3DphxvbecdoI4oGZy47aHNaYjP9BOVwZmB7S+YlN5NslEAzhCoGXd7Xl L/BeNVNqjfzhmiz9wjICwqJ9sXy7u1YknHJcNrUgkVGNMHqjy7DKlYEuM1BgLPUPvCramNFOp m4NcPHRqIJilnJ0hv4fARkOhzrL4N62O1abC65x6yz8xQMF4XmgC879hqLAG0C8u2OuET1OB7 nFG0dlW6GsvtjcchnP+lrfzVMy9lkC/vvjOwIuulAVs1sCcx9mN1wWWcBufhu9xqJTttD8p3A 9+sO/TZ4x0HyCHUOp2EH+BxdtMeYTyvngzLpSfW0YIJG+JmLOw6xSw9korbTCnFpWEfq2WG1b Ua8Mr8c4CtVhLPpZxS1ghEwXI2hdwHXR6Xv2Smh5ya0n2EljPhGL18dGJ672qdPyB3yuNCjz3 xHoFqk5hHAGrG2aaitomiifc47CuA3h6v9ObRi7NHQ6aVlRVwtN+K+wyC70TeLHDOYJlvuIXU vrN8WpGONaiDGjDzromyCpqTk6lowSAxKLppawL/jZgmIOIR2u2UIRiUNiCUd9oOAw9OmXfBw aFZ7TQHQ3RnqjzCt9E43Ike7OzMNSsW/8Svik5MwYA3CVeqRB3HRPdlFQPDS2+f2tPUYlBuG/ PIvonV6 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1215 Lines: 34 From: Markus Elfring Date: Tue, 18 Apr 2017 09:25:47 +0200 * A multiplication for the size determination of a memory allocation indicated that an array data structure should be processed. Thus use the corresponding function "kcalloc". This issue was detected by using the Coccinelle software. * Replace the specification of a data type by a pointer dereference to make the corresponding size determination a bit safer according to the Linux coding style convention. Signed-off-by: Markus Elfring --- drivers/clk/hisilicon/clk.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/clk/hisilicon/clk.c b/drivers/clk/hisilicon/clk.c index 9ba2d91f4d3a..9268e80b7566 100644 --- a/drivers/clk/hisilicon/clk.c +++ b/drivers/clk/hisilicon/clk.c @@ -85,8 +85,7 @@ struct hisi_clock_data *hisi_clk_init(struct device_node *np, goto err; } clk_data->base = base; - - clk_table = kzalloc(sizeof(struct clk *) * nr_clks, GFP_KERNEL); + clk_table = kcalloc(nr_clks, sizeof(*clk_table), GFP_KERNEL); if (!clk_table) { pr_err("%s: could not allocate clock lookup table\n", __func__); goto err_data; -- 2.12.2