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