From patchwork Tue Apr 18 09:40:22 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: 9685249 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 C1CBA602C9 for ; Tue, 18 Apr 2017 09:43:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BE2222621B for ; Tue, 18 Apr 2017 09:43:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B2D85283F2; Tue, 18 Apr 2017 09:43:21 +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 606BE2621B for ; Tue, 18 Apr 2017 09:43:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753239AbdDRJlQ (ORCPT ); Tue, 18 Apr 2017 05:41:16 -0400 Received: from mout.web.de ([212.227.15.4]:60325 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932080AbdDRJkv (ORCPT ); Tue, 18 Apr 2017 05:40:51 -0400 Received: from [192.168.1.2] ([77.181.207.195]) by smtp.web.de (mrweb003 [213.165.67.108]) with ESMTPSA (Nemesis) id 0MHY0i-1d1V140Fmm-003Mvo; Tue, 18 Apr 2017 11:40:26 +0200 Subject: [PATCH 3/6] clk: hisilicon: Use devm_kmalloc_array() in hisi_clk_alloc() 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: Date: Tue, 18 Apr 2017 11:40:22 +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:MOiXfZqrujtuPgjDpMlWQW5FhvCarzAPVw+FnBhCbi9UKYA6rDz zNgkK65PqfGuimLyspVnwOpYMz7jmavKnVznuu1ZgSA5UfPt333lnJbs1+uyevGFqOmkG2H TFpFATbxlVKuOk0Nw+ubuWnmNTnnW7O/qIZm294ALAousd9bWpUs17XaX8Ysug/CNAPpP82 EJ3pautScPgFtrAR49KeA== X-UI-Out-Filterresults: notjunk:1; V01:K0:77/XnU5iGwo=:/koveZEVJRUyxHpbIwqUFN pHOU8ptc0ZOV/X30hkMwzxyZ1Mak43yiJ2ta9lH6azmBJXDgZOBdrnQbRRLf6dBG+E8oPphOs iZbmjMtG2KGIqswPrf8qGX8lFR2pcjITh+YZIEKGEXtPmABqbNaA06BxzI5s/X6qD5d8KaEMF 2SRFPB2bYkk18dtoGBQ0e1y/yxCaLtfiLvQrIr2fs5paPCXjdwJkeHK2PRLQfsKnhwAFZbAvn 3fT28jAvOpMmasZHAnT3pZV5YQR3ZyvIJ1L88YpmmJpSOsy/p96FqRyOD1uQb2vZKr4GZtY4I RuLZYqBASgS+RDtkmploypsJdBH76GD4JdezbVOfEE9n4sykxaKoHuYstfaKMB0BmyD4LGZzO Zi4deqUtnTpVZCHYQIbpjAMFZkduLyMdnVAmF5iOkjdwSicfmP2ubTvVzPEG/Da1rb5Cydc1f AcY3ah50hxeQdGSyGrajupqbs7cifuEAqhmmq9TXP1K8rZa0a8C60iSfAnuj6t0hLAdLg7QQ4 UIwD/aAz9nBHGd0ixB8ttJn1UqzzN0kXZAX1Q5HWLzfLeKsNWzQ/Irg3oIRS8ndSOERvBh64m fL04ox9CLimg/lbIOjmaTG2vAPzeR3ELdbKRSZRhbbpvvFxYwIyMovnHiw0ePw7rnG6weJnKH ecF63+YfErnI5+E7YTWNKcuNoHpkOcYwE5FWqTHOgS6D4z4un7nNaTfvxpbcb0ZdUzg3V3b+g FlQwypGbvZJHjKtKVgn1OE5Q3nSyeElanAhW5/5nLBeykCsqb4v+mcRER13rtK9/pUJZm5d1f 0mxL5M0 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:15:19 +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 "devm_kmalloc_array". 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 | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/clk/hisilicon/clk.c b/drivers/clk/hisilicon/clk.c index eca4c66e316c..b73c1dfae7f1 100644 --- a/drivers/clk/hisilicon/clk.c +++ b/drivers/clk/hisilicon/clk.c @@ -54,8 +54,9 @@ struct hisi_clock_data *hisi_clk_alloc(struct platform_device *pdev, if (!clk_data->base) return NULL; - clk_table = devm_kmalloc(&pdev->dev, sizeof(struct clk *) * nr_clks, - GFP_KERNEL); + clk_table = devm_kmalloc_array(&pdev->dev, nr_clks, + sizeof(*clk_table), + GFP_KERNEL); if (!clk_table) return NULL;