From patchwork Tue Apr 18 09:37:26 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: 9685235 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 6418F601C2 for ; Tue, 18 Apr 2017 09:38:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5B060205F7 for ; Tue, 18 Apr 2017 09:38:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4E838283F1; Tue, 18 Apr 2017 09:38:39 +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 E5BAD205F7 for ; Tue, 18 Apr 2017 09:38:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756047AbdDRJiB (ORCPT ); Tue, 18 Apr 2017 05:38:01 -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 Received: from [192.168.1.2] ([77.181.207.195]) by smtp.web.de (mrweb004 [213.165.67.108]) with ESMTPSA (Nemesis) id 0LwD3G-1bxrUl2gMI-018722; Tue, 18 Apr 2017 11:37:37 +0200 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-Language: en-GB 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-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: 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;