Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1623600

[PATCH 10/10] pinctrl: mxs: Use kcalloc() in mxs_dt_node_to_map()

From SF Markus Elfring <elfring@users.sourceforge.net>
Newsgroups linux.kernel
Subject [PATCH 10/10] pinctrl: mxs: Use kcalloc() in mxs_dt_node_to_map()
Date 2017-04-14 11:30 +0200
Message-ID <tw5Id-7LL-1@gated-at.bofh.it> (permalink)
References <tw5oR-7Fv-11@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


From: Markus Elfring <elfring@users.sourceforge.net>
Date: Fri, 14 Apr 2017 10:32:29 +0200

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 <elfring@users.sourceforge.net>
---
 drivers/pinctrl/freescale/pinctrl-mxs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/pinctrl/freescale/pinctrl-mxs.c b/drivers/pinctrl/freescale/pinctrl-mxs.c
index 9e6dc0038c35..1479610091d5 100644
--- a/drivers/pinctrl/freescale/pinctrl-mxs.c
+++ b/drivers/pinctrl/freescale/pinctrl-mxs.c
@@ -96,7 +96,7 @@ static int mxs_dt_node_to_map(struct pinctrl_dev *pctldev,
 	if (!purecfg && config)
 		new_num = 2;
 
-	new_map = kzalloc(sizeof(*new_map) * new_num, GFP_KERNEL);
+	new_map = kcalloc(new_num, sizeof(*new_map), GFP_KERNEL);
 	if (!new_map)
 		return -ENOMEM;
 
-- 
2.12.2

Back to linux.kernel | Previous | Next | Find similar | Unroll thread


Thread

[PATCH 10/10] pinctrl: mxs: Use kcalloc() in mxs_dt_node_to_map() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-04-14 11:30 +0200

csiph-web