From patchwork Thu Apr 27 19:47:38 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: 9703403 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 C676E60225 for ; Thu, 27 Apr 2017 19:48:09 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B221F28623 for ; Thu, 27 Apr 2017 19:48:09 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A6C3B28627; Thu, 27 Apr 2017 19:48:09 +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 45C8128623 for ; Thu, 27 Apr 2017 19:48:09 +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=szDKWpx1yJK5bdJ0a+piuLWXFB+w7PDIgE8KtOlVuSg=; b=tMIMOmDj1iC7K6 yKj1BZvEOEs8eVqKzKZgEbR59D7vvVOPqjNSUw1IR8QwCry1xMV3JdsbtC2OLZVs25N6LqVEprrFR yCcyCM7oNp9vlrQjSESuGqS2i9IyGhErKWJC5yrfSZ7pVwSg5/hQavcRBd3Ziu7rFtAlt3VaBG1gY 0PpUHIzjvA93TQUNY2/5vtHB8H4UEYCQ65e73ulQ/Y9FHQwteEnZAeGcCUqAmZ+JKBaBCcqaPu4C3 w7X6IGsaNKgFA/8PxWBCsOWpgug8EPVTgoCUwW2f5QB8J93AoSqfh3phTJLCQ5VjIdHxr3cmxDFR2 SkTYnJEGW3wlbN3v3PSg==; 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 1d3pOa-0001M4-Vx; Thu, 27 Apr 2017 19:48:09 +0000 Received: from mout.web.de ([212.227.15.4]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1d3pOX-0001J5-C3 for linux-arm-kernel@lists.infradead.org; Thu, 27 Apr 2017 19:48:07 +0000 Received: from [192.168.1.2] ([77.182.201.44]) by smtp.web.de (mrweb002 [213.165.67.108]) with ESMTPSA (Nemesis) id 0LyE3J-1e9K7K4Ban-015YD2; Thu, 27 Apr 2017 21:47:40 +0200 Subject: [PATCH 2/2] of_coresight: Use devm_kcalloc() in of_coresight_alloc_memory() From: SF Markus Elfring To: linux-arm-kernel@lists.infradead.org, Chunyan Zhang , Mathieu Poirier , Mike Leach , Pratik Patel , "Suzuki K. Poulose" References: <52619d05-65c4-149d-f355-cf9c037a0c9b@users.sourceforge.net> Message-ID: Date: Thu, 27 Apr 2017 21:47:38 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.0.1 MIME-Version: 1.0 In-Reply-To: <52619d05-65c4-149d-f355-cf9c037a0c9b@users.sourceforge.net> Content-Language: en-GB X-Provags-ID: V03:K0:genPIYDBocqoCs7JkiujaToiLIx0ufbwtCCr4X9Vfi96HAFIpdA aBXdoEg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Michelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170427_124805_766920_D9FDB32D X-CRM114-Status: UNSURE ( 8.68 ) 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: Thu, 27 Apr 2017 21:29:12 +0200 Multiplications for the size determination of memory allocations indicated that array data structures should be processed. Thus use the corresponding function "devm_kcalloc". This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring --- drivers/hwtracing/coresight/of_coresight.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/hwtracing/coresight/of_coresight.c b/drivers/hwtracing/coresight/of_coresight.c index 09142e99e915..1e622912cd0f 100644 --- a/drivers/hwtracing/coresight/of_coresight.c +++ b/drivers/hwtracing/coresight/of_coresight.c @@ -78,21 +78,21 @@ static int of_coresight_alloc_memory(struct device *dev, struct coresight_platform_data *pdata) { /* List of output port on this component */ - pdata->outports = devm_kzalloc(dev, pdata->nr_outport * + pdata->outports = devm_kcalloc(dev, pdata->nr_outport, sizeof(*pdata->outports), GFP_KERNEL); if (!pdata->outports) return -ENOMEM; /* Children connected to this component via @outports */ - pdata->child_names = devm_kzalloc(dev, pdata->nr_outport * + pdata->child_names = devm_kcalloc(dev, pdata->nr_outport, sizeof(*pdata->child_names), GFP_KERNEL); if (!pdata->child_names) return -ENOMEM; /* Port number on the child this component is connected to */ - pdata->child_ports = devm_kzalloc(dev, pdata->nr_outport * + pdata->child_ports = devm_kcalloc(dev, pdata->nr_outport, sizeof(*pdata->child_ports), GFP_KERNEL); if (!pdata->child_ports)