[05/10] pinctrl: imx: Use devm_kmalloc_array() in imx_pinctrl_probe()

Submitted by SF Markus Elfring on April 14, 2017, 9:15 a.m.

Details

Message ID 33fef6f9-0ab0-9cd9-201e-c37c53e7b798@users.sourceforge.net
State New
Headers show

Commit Message

SF Markus Elfring April 14, 2017, 9:15 a.m.
From: Markus Elfring <elfring@users.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@users.sourceforge.net>
---
 drivers/pinctrl/freescale/pinctrl-imx.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Patch hide | download patch | download mbox

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;