[<prev] [next>] [day] [month] [year] [list]
Message-ID: <33fef6f9-0ab0-9cd9-201e-c37c53e7b798@users.sourceforge.net>
Date: Fri, 14 Apr 2017 11:15:41 +0200
From: SF Markus Elfring <elfring@...rs.sourceforge.net>
To: linux-gpio@...r.kernel.org, Arnd Bergmann <arnd@...db.de>,
Gary Bisson <gary.bisson@...ndarydevices.com>,
Laxman Dewangan <ldewangan@...dia.com>,
Linus Walleij <linus.walleij@...aro.org>,
Paul Gortmaker <paul.gortmaker@...driver.com>,
Peng Fan <van.freenix@...il.com>,
Shawn Guo <shawnguo@...nel.org>,
Vladimir Zapolskiy <vladimir_zapolskiy@...tor.com>
Cc: LKML <linux-kernel@...r.kernel.org>,
kernel-janitors@...r.kernel.org
Subject: [PATCH 05/10] pinctrl: imx: Use devm_kmalloc_array() in
imx_pinctrl_probe()
From: Markus Elfring <elfring@...rs.sourceforge.net>
Date: Thu, 13 Apr 2017 15:35:27 +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 "devm_kmalloc_array".
This issue was detected by using the Coccinelle software.
Signed-off-by: Markus Elfring <elfring@...rs.sourceforge.net>
---
drivers/pinctrl/freescale/pinctrl-imx.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/pinctrl/freescale/pinctrl-imx.c b/drivers/pinctrl/freescale/pinctrl-imx.c
index 44dbf6e38d79..078875361d76 100644
--- a/drivers/pinctrl/freescale/pinctrl-imx.c
+++ b/drivers/pinctrl/freescale/pinctrl-imx.c
@@ -726,8 +726,10 @@ int imx_pinctrl_probe(struct platform_device *pdev,
if (!ipctl)
return -ENOMEM;
- info->pin_regs = devm_kmalloc(&pdev->dev, sizeof(*info->pin_regs) *
- info->npins, GFP_KERNEL);
+ info->pin_regs = devm_kmalloc_array(&pdev->dev,
+ info->npins,
+ sizeof(*info->pin_regs),
+ GFP_KERNEL);
if (!info->pin_regs)
return -ENOMEM;
--
2.12.2
Powered by blists - more mailing lists