From patchwork Fri Jan 13 17:11:12 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: 9516035 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 4C14C60761 for ; Fri, 13 Jan 2017 17:11:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3A58E28761 for ; Fri, 13 Jan 2017 17:11:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2F05C28765; Fri, 13 Jan 2017 17:11:22 +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 CC67428761 for ; Fri, 13 Jan 2017 17:11:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751095AbdAMRLV (ORCPT ); Fri, 13 Jan 2017 12:11:21 -0500 Received: from mout.web.de ([217.72.192.78]:54240 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750906AbdAMRLU (ORCPT ); Fri, 13 Jan 2017 12:11:20 -0500 Received: from [192.168.1.2] ([78.49.203.248]) by smtp.web.de (mrweb102 [213.165.67.124]) with ESMTPSA (Nemesis) id 0Lvjn6-1cVdj33pcK-017WwU; Fri, 13 Jan 2017 18:11:14 +0100 Subject: [PATCH 03/17] spi: fsl: Use kcalloc() in of_fsl_spi_get_chipselects() 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: <0b7517f1-5f9f-a002-ac59-c5921fec1eeb@users.sourceforge.net> Date: Fri, 13 Jan 2017 18:11:12 +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:sTeZK2clnpDLUikCgeXR0Opi23Vhyvq//z3l8HFfxMpmcx4S0kV qY+dNuP4vGehi9GjiZNpCHX8IXZho3cRqiUuap7fJQ4VJ95RD71rJAJM6oPa1az1remAz6t 6HY1Otkyxhb7RF5Cz/jJQTYIjjcxhxnZqpwm1XfLfNGEYw3XwBSHb8lQsZpJheykTmWEag/ 1wrwb1uSi+xGVIAncA5Kw== X-UI-Out-Filterresults: notjunk:1; V01:K0:hoENmQMvNBA=:P+3Jya7DOSGcOJAGmoVhCE ySfFeOBTuItZqyzgNUb6LN4hyXzpe+lfSjZvAhfWWH630kxD5eGchT8Kf6hX4E+O5aKYZapdL Z+J8ukBrcRvFCOSxqrJYuOAh3daW1v9W50FBka7tMVqH/jlwK/1hTgjblCEEUV+mF787Iwiob TP8I7AMzGFezZEa9lFFb4m2w1T4qjkB/f7s5Pk/JOWPR8eI275ACreEfWFEk18Ckl/Lm0Z80j WRfPEkY7wjxylo6/puuDOG1vBAFPUl6UaqyPFq7CbTPr92OSOpR4zrDoeC9LS8nXLIsPEPaOe bSzzJQtnqn+PEHJPnXJoPe+0dhuYPPaB+j+Sb2dYO23j3DW+b4sRZH5N+ivJqqZmbdoGpmWiK 6DBIx0x6DW7XjooJFBe6JQCN3vv86fU1E3As1dxh7XyemrGtBZQYKrMoaK+bzd7dblY4Ez+4h f9Fe+ehZa4zOZGlnvq+rloN1ldg9mvwoP0P4qmrOGI2VVICMgcEw9wTuj2oAwMU4rUXbbgcT3 zYOyzrC6S24ZKEQLEw6DhdXeoK5HALiqfcGadgdwm/JcFvRFNL1rap7xDqjf7f//9rATe8+gQ prGskhYH3KT3S3CnesODifeB/XJyeWLnmnWYLC/J8pNo8r7BDuHqup0kspbHiuQVAAg2HXjzi UuWkzJtUEiLEWG6gZF5+zBsCh/q62S8a3ILaaz888rCFrynpbl3/+UnMCbcaXsv3TkdDnlDY0 OnEIB7vyvUVjdSBEjkKyYi7wsKRieHOIoNfQ1w/KoaP7leC7pBj3e9oYeJpIblxLyERR1bvSw q+dRNOo 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 13:33:02 +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. Signed-off-by: Markus Elfring --- drivers/spi/spi-fsl-spi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/spi/spi-fsl-spi.c b/drivers/spi/spi-fsl-spi.c index 8b290d9d7935..d1b26c9fe950 100644 --- a/drivers/spi/spi-fsl-spi.c +++ b/drivers/spi/spi-fsl-spi.c @@ -732,7 +732,7 @@ static int of_fsl_spi_get_chipselects(struct device *dev) return -ENOMEM; memset(pinfo->gpios, -1, ngpios * sizeof(*pinfo->gpios)); - pinfo->alow_flags = kzalloc(ngpios * sizeof(*pinfo->alow_flags), + pinfo->alow_flags = kcalloc(ngpios, sizeof(*pinfo->alow_flags), GFP_KERNEL); if (!pinfo->alow_flags) { ret = -ENOMEM;