From patchwork Tue Oct 3 20:15:19 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: 9983451 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 8A0E760365 for ; Tue, 3 Oct 2017 20:16:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 93CD628A05 for ; Tue, 3 Oct 2017 20:16:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 88A7D28A0F; Tue, 3 Oct 2017 20:16:17 +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 432B628A05 for ; Tue, 3 Oct 2017 20:16:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751609AbdJCUP7 (ORCPT ); Tue, 3 Oct 2017 16:15:59 -0400 Received: from mout.web.de ([212.227.17.11]:50319 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751396AbdJCUP4 (ORCPT ); Tue, 3 Oct 2017 16:15:56 -0400 Received: from [192.168.1.2] ([77.181.6.116]) by smtp.web.de (mrweb101 [213.165.67.124]) with ESMTPSA (Nemesis) id 0MOixm-1dvdZn3lYs-006BQY; Tue, 03 Oct 2017 22:15:22 +0200 Subject: [PATCH 3/4] ARM: OMAP: Use kcalloc() in omap_system_dma_probe() From: SF Markus Elfring To: linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Aaro Koskinen , Russell King , Tony Lindgren Cc: LKML , kernel-janitors@vger.kernel.org References: Message-ID: Date: Tue, 3 Oct 2017 22:15:19 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 MIME-Version: 1.0 In-Reply-To: Content-Language: en-GB X-Provags-ID: V03:K0:wLMKMtN4PbrP7xUT3zLrnAt0xvxzvFswkMz67vbQisw297VUNh6 w+GNSfHC8JJV5AlhR/oDaFn2jGd4CjcfPmgUfmgiXjo9p8dQgQ0ypNU3nQ73SrGusSA5jEm mm+IIcHd5q0MhEdfLvE75RimPlI4ub81TtojofwioqMbpPFz35VFji3w++xmUo8VmOhtSw7 1Ae9PV6FLcD6EfthdnI2g== X-UI-Out-Filterresults: notjunk:1; V01:K0:uoHxXGqIok0=:cv1Mx8Pny8BeuFx/Li+sYc N/l04wrl8awZjL+xzqQY+cbUSf5YPwjZfXnn2UbiGZ9/0ddmN5xSKWBIzM4I6kQBJ0EI/Vktc 58Pp+OOdGHBddus8SLr08a6x5ZU1G5+Z8/R3leJVMWkBtRfPerA0NqeITPpPlCbXO4ByMmU0T yn/rf0XBnL4d4XA26KAiCRNYD8FLI1hvlB3pDO5VQIq9deLsZos29WJF3ZAd3E77nChZ95Skv 7c26bW3v5MrkmTjG5aSBIBDbGIezrTMxcq2eJYUx/QnAKKx+ceqdnb4OW1aPGpIpIRVYy/ByM UOXW1SCh2GzpscIMuRJZ5mVxah2WtzdcyCFF0enoPI4pvtl6zuKLyF+y5JbvvhUaLCajd10Pc LQVrMnnnnx1h8kSeSXTGQuce4aUtRAKvfu3Xpnr9mDu2KDwPNsHwbYgWna0Q99cxmCt+oTZTh gEQ70ZGi74C7yGtvsKayHaHgfKsf5e4jug2/pU17et7KKdHl5WLDZgw9Nc/abW9LGM/DjEOqx UqJSFeQXcfKG6hS4/GQTebNLW487N//7TlPtOOPGyuYdEllQUER2W5XI5nmtMeGSnoxkEgsqQ uHNlNX7BDufMs/AL7fOx9AYTfrWQjTTiFsuzAySS/fzgHKjL1RCg+BYUvHib1AtTtQS6zxLgb cSv9Rdwasi/q7QzhTAQkMWliXp1w+TeBJvUJWsu3eVlZRput6aLJukLHnpfL7TPET2BeGsog3 ODFycnsQQp7KG2greyZfecEI9ILFZZ+kI0VBCCzCOwm+jeX4wnrRYcKxroX/kj66iz1qJYpAB 1pu87wY1C0+Eky6tMp3sSniwBlsvCJ25eHqSv/b85JgKJyxtsk= 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: Tue, 3 Oct 2017 21:07:33 +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 --- arch/arm/plat-omap/dma.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/arch/arm/plat-omap/dma.c b/arch/arm/plat-omap/dma.c index 409e4ecaebe9..d4012d6c0dcb 100644 --- a/arch/arm/plat-omap/dma.c +++ b/arch/arm/plat-omap/dma.c @@ -1321,8 +1321,9 @@ static int omap_system_dma_probe(struct platform_device *pdev) return -ENOMEM; if (dma_omap2plus()) { - dma_linked_lch = kzalloc(sizeof(struct dma_link_info) * - dma_lch_count, GFP_KERNEL); + dma_linked_lch = kcalloc(dma_lch_count, + sizeof(*dma_linked_lch), + GFP_KERNEL); if (!dma_linked_lch) { ret = -ENOMEM; goto exit_dma_lch_fail;