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: 9764465 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 8F25D602B6 for ; Sat, 3 Jun 2017 18:33:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 86955284EE for ; Sat, 3 Jun 2017 18:33:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 774D628557; Sat, 3 Jun 2017 18:33:38 +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=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 0544A284EE for ; Sat, 3 Jun 2017 18:33:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:Date: Message-ID:References:To:From:Subject:Reply-To:Content-ID:Content-Description :Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=aqxdYkH/SQQtI41ku9AqgZt/50ylNvySSNE1sd41WPk=; b=p3DDjrpzKTtCSF +YqGDamrusB3ZeS2Y+slGLuYNGZaOT3gFWcZ+jcuwOHd+GHIwR9bT63Z/MP9pqq5dACRlzooQoDyZ tdZOALh6wKr9Do9deXVjMccJ2ErNafo1kFkjwvnvL+fZX3wLl5ihNjtVcFF/4duyemeMkh9J7O9Ub Id4XKwmYQrzZ509dlDmeOUNjgXmgNqL/5xPpWiSvXQhyiDKNroOiwwMJsdZ09wJ5wgcEuHssOmhTz pDVsO4vfK/P0U5+RRNXjEkPO4duN5YL9B5DCoaiRIxanHbxWCUmD3+2ht5zk5dZ68qeoXpp5Btc1E 56gVLphnqCXUbALofgzw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1dHDrl-0008Js-2P; Sat, 03 Jun 2017 18:33:37 +0000 Received: from mout.web.de ([212.227.15.14]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dHDrh-0008Hy-Vz for linux-arm-kernel@lists.infradead.org; Sat, 03 Jun 2017 18:33:35 +0000 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 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170603_113334_346620_D70C7BA4 X-CRM114-Status: UNSURE ( 8.63 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kernel-janitors@vger.kernel.org, LKML Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.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) {