From patchwork Tue Apr 18 09:41:48 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: 9685247 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 ED212602C9 for ; Tue, 18 Apr 2017 09:43:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E6AB72621B for ; Tue, 18 Apr 2017 09:43:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DB5DF283F2; Tue, 18 Apr 2017 09:43:15 +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 8ED0B2621B for ; Tue, 18 Apr 2017 09:43:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755247AbdDRJm2 (ORCPT ); Tue, 18 Apr 2017 05:42:28 -0400 Received: from mout.web.de ([212.227.15.14]:60783 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932120AbdDRJl6 (ORCPT ); Tue, 18 Apr 2017 05:41:58 -0400 Received: from [192.168.1.2] ([77.181.207.195]) by smtp.web.de (mrweb003 [213.165.67.108]) with ESMTPSA (Nemesis) id 0M5x4z-1c6uN21YxF-00xpV0; Tue, 18 Apr 2017 11:41:49 +0200 Subject: [PATCH 4/6] clk: hi3620: Use kcalloc() in hi3620_mmc_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: <9c35e91c-36c6-f33e-a283-4304ad118a22@users.sourceforge.net> Date: Tue, 18 Apr 2017 11:41:48 +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:FBIeT2lA5JNE0JRsdkiEO5P0txYW8FOkfxP04jJOn95GRGzUO5y bD/HJrECD+yrkMJ0VIV+G0zhng8bgoV5mYMPyiATMZw+wn9L6V8EI18EEgF34fCEctVszlF 24v401JsWjRo6I5IxWr3nHyjklD1WB5l5G+ZOOmksif7X9XTaVaG2/1a6IE3FbGPxGQUSMO FOOFdKtblhNiVrlnVwnjg== X-UI-Out-Filterresults: notjunk:1; V01:K0:Vz4ZzWiscbA=:MjHOqYsdkeNWyP9tr5BUZ0 8pJm0FvO6aV7im2cWP1TZ5BhY2Z9yFJmK9uTZmgqdh4lTB3zUfnUvQXS+4rs9Y3/3FZXH7a8y rZwgVWAOwrTmgyqhEkwwVc+w8pGcIuNvuF3RkPOSntwDDMqEA3YQ7/C5Wo8VVfOFNoo0yd6R4 fMsL82Vg0uWmvUrHF8kKxvTmj0/uFwEQAzU2ZaQjOOC0N7zApOhhgIAvQ20yoNFh2KuDI/qSl Spoww0pENFMiV3Q35UClzAT2Fb5+UsF/fT5Z29JAZr7FSAqcid825YH7A3yj5NGKm68+Xgy0Z ktbSVQbicYFkGaT9GSudExEjooSQ43JDzCfeI/DtWTLqVGJUq0fRchoGtimfEq/FZbHpt2kup W59U4L54DvruJ5Eyq5kCk0RaF2EtscK0A/xGaDKsUQ0sFpn4MFqYM7B4YLqsLzWp8mTq4oB2y qs3IaRqSzOJNdVfpw3yz8LGW5cyfWlvLTIzXzOgZyVWZouQh6WRMB3rtlTnvpC+856dO9wd1j 78Hh/7SVYMWEeWorLRuKCFNvO80yLSqtCLjXUyGwr3diQJ0jEljhGp20eIceiqaZJybNB1oge ea6Nl45V4Nxl/WHE84Yh5uBn9E7o7ErgaX2GT+PEAvuLGz+x88TC17Bkcr04RKxbODxoxNYfh 3ACU+C7ITaJ9j491/s7e6ZE/a7VjX/7LnYzbYPyprK05w+N0BbYN8Vz6chNFm2fWLTtU7GGtv 1A17hdfdELvIUorOVyhz/so6f6kz+Nc2BIKln+cVB4NeXvtj9EUEtrE4ccPXComhDYiTT638A MzpujVK 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 10:30:04 +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-hi3620.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/clk/hisilicon/clk-hi3620.c b/drivers/clk/hisilicon/clk-hi3620.c index d04a104ce1b4..f6dd971c9d3c 100644 --- a/drivers/clk/hisilicon/clk-hi3620.c +++ b/drivers/clk/hisilicon/clk-hi3620.c @@ -482,7 +482,7 @@ static void __init hi3620_mmc_clk_init(struct device_node *node) if (WARN_ON(!clk_data)) return; - clk_data->clks = kzalloc(sizeof(struct clk *) * num, GFP_KERNEL); + clk_data->clks = kcalloc(num, sizeof(*clk_data->clks), GFP_KERNEL); if (!clk_data->clks) { pr_err("%s: fail to allocate mmc clk\n", __func__); return;