From patchwork Fri Jan 13 17:16:57 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: 9516053 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 233A8601E5 for ; Fri, 13 Jan 2017 17:17:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1320E28765 for ; Fri, 13 Jan 2017 17:17:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 07C3F28767; Fri, 13 Jan 2017 17:17:41 +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 ABFB528765 for ; Fri, 13 Jan 2017 17:17:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751337AbdAMRR1 (ORCPT ); Fri, 13 Jan 2017 12:17:27 -0500 Received: from mout.web.de ([212.227.17.11]:58222 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750996AbdAMRRY (ORCPT ); Fri, 13 Jan 2017 12:17:24 -0500 Received: from [192.168.1.2] ([78.49.203.248]) by smtp.web.de (mrweb103 [213.165.67.124]) with ESMTPSA (Nemesis) id 0M2uao-1clXnV2jo6-00sgHq; Fri, 13 Jan 2017 18:17:03 +0100 Subject: [PATCH 08/17] spi/ppc4xx: Use kcalloc() in spi_ppc4xx_of_probe() To: linux-spi@vger.kernel.org, Mark Brown References: <1413e173-dbac-7a6e-09cb-2287300a335e@users.sourceforge.net> Cc: LKML , kernel-janitors@vger.kernel.org From: SF Markus Elfring Message-ID: <777d3bd9-4817-d688-d496-b871edbbc937@users.sourceforge.net> Date: Fri, 13 Jan 2017 18:16:57 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.6.0 MIME-Version: 1.0 In-Reply-To: <1413e173-dbac-7a6e-09cb-2287300a335e@users.sourceforge.net> X-Provags-ID: V03:K0:LKaC0n5A4UrIY11K8aawN4kIZ6co5UnpWEFciyagcbIEGFgtkF9 A+kUMuPj0BYRsCIptw59r5AewCqBD2AhMTArYIlt7kTkScl/pPXTA03Tw3OhFzsvfoNoo9s wddRZQX6rgLPaVdqtQ7k1RuPzpW7+w4Xp/2uxMv2stGRLrs/aaWMfSDkID+RYFGTV7PIOR9 E5RUJChO6CbY97vI6Pjrg== X-UI-Out-Filterresults: notjunk:1; V01:K0:LJE+eBqanYI=:y4dmKIWESRYMJiq/VTmH9Z j6oJaL7iUxxW95YEslh8H/M67IxSZSOBACgIcN/W+qgQF2Z/xgM0JUBAIobI9ROILrWcANi5D 5KGopX25vkL/DInZ9Ti+JD6kMnumvp0pbPEXPhi7mkrsUUKm2qKVz14P/97jwiusGCts7YsjG 8PmTJ8kVkh2yH6hruOatXLESMWe2A4vRkorwXKKbON+UC/okpakpkSjTl+eRy/ZF/dEjkWGLI JWfZxuXuf5p2WjdX4SbJ+qy0XBnfgZphU2zyxs4NduI2M5pqfeBLrMMPOPK7/swovdDnEoXVp 3fDCg2RcnQdl+qoNJQC62RNo+FMEFExpSY9/VwKVYX9JqVBELvhTo0vypXENGGW25L8hV+wkG UF+y8fF1n+hIowcf1UkR3YZGvnSABAKImneF9Fto0ZwWanTXCehs8TbP3JTMaQnA2huqHikDu retzCMqtdFt5Jzl3+/iM9Tc2U1lDMtRbzIZPbzzTkwndM55yTgUl4JKN7bueGQWd3wMb5D3Oq 0IJLtwEVgYgxTzFnV3jsC+R2GTk+iG3sfZwbymPsdNJ0yDrlMJ0Mrp/yK9q2mnZNTbyVhzok4 hKKS62s9CeCW2R66rxRQsNW/As7LGI8b/pXnFGJjLnp9jenv+f5IObOQzmX4wIaNNTbY/huvl cYPql8duOIlRLL2zwEjVZzCmZ+A5iAKW4dEsPi/OeRtYJjDgY2f1WxNXGJ6H8/wGb8lE46aA8 3ArIW3Enwqcg50ZUWO9tQvxxSJzAVM6rBK5Gq3L12FSYzfkTf/sG1upI59GBO+ioCYN99wyPB AflS22i Sender: linux-spi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Markus Elfring Date: Fri, 13 Jan 2017 14:30:43 +0100 * A multiplication for the size determination of a memory allocation indicated that an array data structure should be processed. Thus reuse 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 --- drivers/spi/spi-ppc4xx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/spi/spi-ppc4xx.c b/drivers/spi/spi-ppc4xx.c index dd3d0a218d8b..e0c39734d6ef 100644 --- a/drivers/spi/spi-ppc4xx.c +++ b/drivers/spi/spi-ppc4xx.c @@ -411,7 +411,7 @@ static int spi_ppc4xx_of_probe(struct platform_device *op) if (num_gpios > 0) { int i; - hw->gpios = kzalloc(sizeof(int) * num_gpios, GFP_KERNEL); + hw->gpios = kcalloc(num_gpios, sizeof(*hw->gpios), GFP_KERNEL); if (!hw->gpios) { ret = -ENOMEM; goto free_master;