From patchwork Sat Jun 3 18:33:10 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: 9764467 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 0EF60602B6 for ; Sat, 3 Jun 2017 18:33:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0890D284EE for ; Sat, 3 Jun 2017 18:33:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F165D28557; Sat, 3 Jun 2017 18:33:40 +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 9B51D284EE for ; Sat, 3 Jun 2017 18:33:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751184AbdFCSdj (ORCPT ); Sat, 3 Jun 2017 14:33:39 -0400 Received: from mout.web.de ([212.227.15.14]:55299 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750991AbdFCSdi (ORCPT ); Sat, 3 Jun 2017 14:33:38 -0400 Received: from [192.168.1.2] ([77.182.192.46]) by smtp.web.de (mrweb001 [213.165.67.108]) with ESMTPSA (Nemesis) id 0M1FqS-1eAQud27iK-00t9Nb; Sat, 03 Jun 2017 20:33:11 +0200 Subject: [PATCH 7/9] ARM: OMAP2+: Use kcalloc() in sr_set_nvalues() From: SF Markus Elfring To: linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Russell King , Tony Lindgren Cc: LKML , kernel-janitors@vger.kernel.org References: Message-ID: <201e94ac-bbd7-5fb0-582b-4a6b2585bdab@users.sourceforge.net> Date: Sat, 3 Jun 2017 20:33:10 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.1.1 MIME-Version: 1.0 In-Reply-To: Content-Language: en-GB X-Provags-ID: V03:K0:zCQeEgamlcOOHKD03VM8SupEkOwjFnQZ3gFiOnaz0/K843lF7iL w9lnRIihmQ+gQPe1O1nlW4IcbuaPJcDvilcTd9vAj85H4vr4U63EgYQN10LfwLjaHYg7tTQ k/vh04d+Klmpg5DKkaHAkU5wvRovl2JSyVrNLSieBpltCBJU/gF9Zm+YVpaC/GKQUe/5bGi uCRMXDbeo2EPNMtK4uY8A== X-UI-Out-Filterresults: notjunk:1; V01:K0:Cgrsn+2hzZA=:FyLaSQAQKEJCvuYyJ9Ur9Q kftbpQ6s38ggiNxpz0O5qLU3p+NucLSZlvP9WbhJAgrP3idGwwJeFZwsrNIwWp2UmWn/tuUo5 X3hECDxWaDSVN///K+wkxE65hV5jsMC31lX5xtbM2yDLzfkq+no12qGtxFY4B0aLQOqQzlR+E dTYp/vUMCEfWDVSI6Kugh0F+oCZFrXY4aoGB69BJA38ei1K9CFvn3TxzKMWQBmf/f41uSw3gl pSnkgSpd3Zqqvdy1v8acVNiaLbZjvIKfaKy+Hh4/JzpTXvgGnJ3tsunU+TAk2hOzKrvDRt+DN AvIw++wKjdr8dobnIi80ZKhQ2Yk9RfIImI9PehZhxDXyW69R/YrN/dcqLUtGW/CjDnfQIsnka tPr68rVaogcoJMMYfYKk9mdcYKgVDc27sdl3pnB+CyrE48GgmrPYuYhZTYnc5Zydrhd35cXkl xR6xwPjmZ1CdrgblVGJMoHgAf27lMpsrqqX2eT9EBdCmFmzguvYcVuw/M/OOuF3YsZqxok9E1 g7dAhWJyPQrsjOTWEBiWz2WLe12aYPkSsg777KXbs8BmLvMeA55Ah9WRBiPh++UsvqSaRRZtC p1ZR6s9a3lukvsU3aZtNowcwLbmQYXTjXFEDj5IYfn9PWNH3nsn8/c0++cBgOU7CA9MivSn82 3XmoEJTtLXAZKvsW2r4DUrvZDdWnsmW1Yuu0x7XYb3TDU/emoV8lsUxXR5rVFdsRqEHqqPqwk uWzMIokM/PNeraWjQzlBMFp2ujmi26yHN/YWq5ayS8GaP4tFAC1XKpC4WWh5UfmFaxcgb9b1d e7h4yrl Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Markus Elfring Date: Sat, 3 Jun 2017 19:09:07 +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 structure 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 --- arch/arm/mach-omap2/sr_device.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/arch/arm/mach-omap2/sr_device.c b/arch/arm/mach-omap2/sr_device.c index 01df4907c0e3..65775c6e8c27 100644 --- a/arch/arm/mach-omap2/sr_device.c +++ b/arch/arm/mach-omap2/sr_device.c @@ -44,7 +44,5 @@ static void __init sr_set_nvalues(struct omap_volt_data *volt_data, while (volt_data[count].volt_nominal) count++; - nvalue_table = kzalloc(sizeof(struct omap_sr_nvalue_table)*count, - GFP_KERNEL); - + nvalue_table = kcalloc(count, sizeof(*nvalue_table), GFP_KERNEL); if (!nvalue_table) {