From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753218AbdDNJWn (ORCPT ); Fri, 14 Apr 2017 05:22:43 -0400 Received: from mout.web.de ([212.227.15.14]:53073 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753030AbdDNJWk (ORCPT ); Fri, 14 Apr 2017 05:22:40 -0400 Subject: [PATCH 09/10] pinctrl: mxs: Use devm_kcalloc() in two functions From: SF Markus Elfring To: linux-gpio@vger.kernel.org, Arnd Bergmann , Gary Bisson , Laxman Dewangan , Linus Walleij , Paul Gortmaker , Peng Fan , Shawn Guo , Vladimir Zapolskiy References: <59fae4ac-9e07-232a-4843-92dd9e0cf2ef@users.sourceforge.net> Cc: LKML , kernel-janitors@vger.kernel.org Message-ID: <6b3abc7c-7fae-ce75-585c-8944153a9627@users.sourceforge.net> Date: Fri, 14 Apr 2017 11:22:24 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.0 MIME-Version: 1.0 In-Reply-To: <59fae4ac-9e07-232a-4843-92dd9e0cf2ef@users.sourceforge.net> Content-Type: text/plain; charset=utf-8 Content-Language: en-GB Content-Transfer-Encoding: 7bit X-Provags-ID: V03:K0:tWxtV+RVtS7M2t0Hs5yVkl3h7dpLICAzVxvgRCFqFyf+dzcPYMy xSbRdDWAnigdaVrZ1TXlw4N3EcDDOSeKmrQYpSLuyLLgEm7R5RFMotYxCxGlHKMbfhvyC7v FWAq06CERiUfQ0iRDWOQtk+dfEFr85ohKnUNFCYZAxIOo40CqKfTzL0BKH9FOVgmElIq4mC JaLqAsfyMawsNQpLkjCVg== X-UI-Out-Filterresults: notjunk:1;V01:K0:dELEHwKEZFk=:0hmQJss/aRG+wiHZDdKeN0 7BC0XvNAQjTJzH9PDtF06hRNtwSSWgND0H/gqbM4W0c0TiE1c8331h8hOL47igzkZ5gjITfkM TNwa17TAAekXMZflEgiIPAN4UyyaPTYjguvX9b2stl3wRgft7Rqmdk9sSpGaeLGciF6SU6dP8 P4qNmmNnJzcsJ6i+bjYU0R5RzgQID59xsGRiZm9nrkazHohesyUwmLTZ+XDhocKxQgZ2cIy2M pEji8gSABaEBPicLt8iJxew2RWWd7nuBX3faK7P3paiAlbTLYvKiGHX+dArMAyENokE29LkzM pIpzli/bM4/Hqc5fBEJNc7i1H3Ozii1W2RB3LD3w1pfe/oH5UShABY5c2i9ug4BEz0q29yDR3 qyb1hJVDv2a0ApcA8Vuso+nOq3dR3fgtyUfvKocHkHCwnOOlc5SMB+3KSEh6GfmST9lh4hMa2 XN06M30rUUmLd9OkqWXRJHe+SmP5ET4NvrnH/NjpEtQ+cx9UnryNB1frQRY3B/rlbCyJ0ELqV z3hj9T3KP2Bv12aa1eDrH6MJkFepbmHcOUUmyqaM9mmM99t0s8sBHL8CcpDpe4U3tfYZuosTS flfMpJxF5de+owxpwgwRTkuV7X9IarjkpXI0spCZVI5rLki+ELnrKLQigilJDLQbrYDf8Ku8y 4MUYHGpexSiZi2MkjCdkXKtjCa35LWJiTUoeNYYPKPXbVjbIISgEASEscTXJrJprJ/vkM+9x6 xOtM7CWQosdl3aQ6hCXRZuXo+Wat2BU1cKmCk3f9NoSllTg9LGDwHdiYCbjYPk14impLwbok2 QoaX0qq Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Markus Elfring Date: Thu, 13 Apr 2017 16:28:48 +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/pinctrl/freescale/pinctrl-mxs.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/pinctrl/freescale/pinctrl-mxs.c b/drivers/pinctrl/freescale/pinctrl-mxs.c index 41b5b07d5a2b..9e6dc0038c35 100644 --- a/drivers/pinctrl/freescale/pinctrl-mxs.c +++ b/drivers/pinctrl/freescale/pinctrl-mxs.c @@ -369,12 +369,12 @@ static int mxs_pinctrl_parse_group(struct platform_device *pdev, return -EINVAL; g->npins = length / sizeof(u32); - g->pins = devm_kzalloc(&pdev->dev, g->npins * sizeof(*g->pins), + g->pins = devm_kcalloc(&pdev->dev, g->npins, sizeof(*g->pins), GFP_KERNEL); if (!g->pins) return -ENOMEM; - g->muxsel = devm_kzalloc(&pdev->dev, g->npins * sizeof(*g->muxsel), + g->muxsel = devm_kcalloc(&pdev->dev, g->npins, sizeof(*g->muxsel), GFP_KERNEL); if (!g->muxsel) return -ENOMEM; @@ -425,12 +425,12 @@ static int mxs_pinctrl_probe_dt(struct platform_device *pdev, } } - soc->functions = devm_kzalloc(&pdev->dev, soc->nfunctions * + soc->functions = devm_kcalloc(&pdev->dev, soc->nfunctions, sizeof(*soc->functions), GFP_KERNEL); if (!soc->functions) return -ENOMEM; - soc->groups = devm_kzalloc(&pdev->dev, soc->ngroups * + soc->groups = devm_kcalloc(&pdev->dev, soc->ngroups, sizeof(*soc->groups), GFP_KERNEL); if (!soc->groups) return -ENOMEM; @@ -491,7 +491,8 @@ static int mxs_pinctrl_probe_dt(struct platform_device *pdev, if (strcmp(fn, child->name)) { f = &soc->functions[idxf++]; - f->groups = devm_kzalloc(&pdev->dev, f->ngroups * + f->groups = devm_kcalloc(&pdev->dev, + f->ngroups, sizeof(*f->groups), GFP_KERNEL); if (!f->groups) -- 2.12.2