From patchwork Wed Apr 19 17:54:04 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: 9688575 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 3672F6037F for ; Wed, 19 Apr 2017 17:54:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2C26A26224 for ; Wed, 19 Apr 2017 17:54:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 210CC283E8; Wed, 19 Apr 2017 17:54:35 +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 B795526224 for ; Wed, 19 Apr 2017 17:54:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S968776AbdDSRyV (ORCPT ); Wed, 19 Apr 2017 13:54:21 -0400 Received: from mout.web.de ([212.227.15.14]:65491 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S968759AbdDSRyN (ORCPT ); Wed, 19 Apr 2017 13:54:13 -0400 Received: from [192.168.1.2] ([77.182.113.86]) by smtp.web.de (mrweb002 [213.165.67.108]) with ESMTPSA (Nemesis) id 0MLyCC-1cxcXZ2ZAq-007loT; Wed, 19 Apr 2017 19:54:05 +0200 To: linux-clk@vger.kernel.org, Boris Brezillon , Michael Turquette , Stephen Boyd Cc: LKML , kernel-janitors@vger.kernel.org From: SF Markus Elfring Subject: [PATCH] clk: at91: Use kcalloc() in of_at91_clk_pll_get_characteristics() Message-ID: <2b5c3954-dc45-4f1b-5d94-397f688b23cb@users.sourceforge.net> Date: Wed, 19 Apr 2017 19:54:04 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.0 MIME-Version: 1.0 Content-Language: en-GB X-Provags-ID: V03:K0:2kP87VI5YQFu6BazyEpzDEuvrAWkjhiYRhHuouDCTIzXdQsGZl3 454G6yBP2GEdlSQ0OS3l16Oawv+nWrZWsZ0fICmh6SYlYyB9ZZTmPe0aEJF0Ep9fIgjYXge Vb0EqkOGUDcK8w8/uR0uCxeTQlxk8tM/1Ohz/eCWQMF6K+4ZG946tO3hdb92MqVxceZONiM 1Kl0NWmhdZpMk+7nDhi0A== X-UI-Out-Filterresults: notjunk:1; V01:K0:P6jcocI46X8=:lkZxiQuRrGU3pnYTPAisK4 D1Zl2WfTdNCi+95LlzFTA38TaMwAeGEscQ8tetBu0OeZ5OS7QudZOZAmVTIB0ozslySPCXkun SZ6kWh1HFhCv222jgyIwzCAdAwjBbqW5Mw+6M72cCmOkTCdDPUTrFH0agfDFakAWwau4DnrmQ RTBbm6Q1E2c2WESX3B6mcrOTpziSVr+Zbr1c3X3AtlHZgFMMx/VsO/UZjbELwLCenSBfn5Srg c4UinkdhbkRHt0V2otjcSYZd6bzSsWCuPLWrN5VUABf0FWm5utLdD1fIW0nmE/yQ0GwTxbHPF N1vVZzMcKl8Uz1qvZatQLXyqar9y2LHrJmkhmYSX7ZmngJf8WgdaWK+x+MTKdGYNDWNN6rjF+ VDWoQ2jq/WsszrNKsVbo0OGBvVkK6Wr970mpBC8hhS8snITPpgVG46dUcnkYX2RAZxLB4SO1N Hy0zyZtK55ifz2EEPII27JuslhEuzLaaxUA9Wlg9Mbti2fOY225v37c4mNK2J12PqGz6HaNjx nUrGnERMQCygkdmyQRTr10qeHy1neF+ompOPVIVnbuw3A4K+kpist3twVehsieL0tsmBX+mEQ 8/odL7oO9XzIvFNc0FuBgSgz0rpS3PD+5Q7ZI4JIHa6XHeDowX2WnYQhk7HWhgeYQxdDR603h tIk2wtnuHPJX3KK7HxEaGm+6saJT1xIPnjYtX66I0x/RKjEPFLCBkAWCu1f+Qx2834fPcOJeX YtkkAOcE2Bz1apGEKFKAzaKeCHecAQdwyoiOKLEAdnLLGPzIx7jWptQ3dwB+kASoWrZEJHusZ A5KwiF6 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: Wed, 19 Apr 2017 19:43:03 +0200 Multiplications for the size determination of memory allocations indicated that array data structures should be processed. Thus use the corresponding function "kcalloc". This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring --- drivers/clk/at91/clk-pll.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/clk/at91/clk-pll.c b/drivers/clk/at91/clk-pll.c index 45ad168e1496..7d3223fc7161 100644 --- a/drivers/clk/at91/clk-pll.c +++ b/drivers/clk/at91/clk-pll.c @@ -399,18 +399,18 @@ of_at91_clk_pll_get_characteristics(struct device_node *np) if (!characteristics) return NULL; - output = kzalloc(sizeof(*output) * num_output, GFP_KERNEL); + output = kcalloc(num_output, sizeof(*output), GFP_KERNEL); if (!output) goto out_free_characteristics; if (num_cells > 2) { - out = kzalloc(sizeof(*out) * num_output, GFP_KERNEL); + out = kcalloc(num_output, sizeof(*out), GFP_KERNEL); if (!out) goto out_free_output; } if (num_cells > 3) { - icpll = kzalloc(sizeof(*icpll) * num_output, GFP_KERNEL); + icpll = kcalloc(num_output, sizeof(*icpll), GFP_KERNEL); if (!icpll) goto out_free_output; }