linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: SF Markus Elfring <elfring@users.sourceforge.net>
To: linux-gpio@vger.kernel.org, Arnd Bergmann <arnd@arndb.de>,
	Gary Bisson <gary.bisson@boundarydevices.com>,
	Laxman Dewangan <ldewangan@nvidia.com>,
	Linus Walleij <linus.walleij@linaro.org>,
	Paul Gortmaker <paul.gortmaker@windriver.com>,
	Peng Fan <van.freenix@gmail.com>, Shawn Guo <shawnguo@kernel.org>,
	Vladimir Zapolskiy <vladimir_zapolskiy@mentor.com>
Cc: LKML <linux-kernel@vger.kernel.org>, kernel-janitors@vger.kernel.org
Subject: [PATCH 10/10] pinctrl: mxs: Use kcalloc() in mxs_dt_node_to_map()
Date: Fri, 14 Apr 2017 11:23:51 +0200	[thread overview]
Message-ID: <ed0b8015-20c7-c766-624b-d34b54444d1e@users.sourceforge.net> (raw)
In-Reply-To: <59fae4ac-9e07-232a-4843-92dd9e0cf2ef@users.sourceforge.net>

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


      parent reply	other threads:[~2017-04-14  9:23 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-14  9:00 [PATCH 00/10] pinctrl: freescale: Fine-tuning for ten function implementations SF Markus Elfring
2017-04-14  9:03 ` [PATCH 1/10] pinctrl: imx: Use kmalloc_array() in imx_dt_node_to_map() SF Markus Elfring
2017-04-14  9:07 ` [PATCH 02/10] pinctrl: imx: Use devm_kcalloc() in two functions SF Markus Elfring
2017-04-14  9:11 ` [PATCH 03/10] pinctrl: imx: Return directly after a failed devm_kcalloc() in imx_pinctrl_parse_functions() SF Markus Elfring
2017-04-14  9:14 ` [PATCH 04/10] pinctrl: imx: Improve another size determination " SF Markus Elfring
2017-04-14  9:15 ` [PATCH 05/10] pinctrl: imx: Use devm_kmalloc_array() in imx_pinctrl_probe() SF Markus Elfring
2017-04-14  9:17 ` [PATCH 06/10] pinctrl: imx: Use seq_putc() in imx_pinconf_group_dbg_show() SF Markus Elfring
2017-04-14  9:19 ` [PATCH 07/10] pinctrl: imx: Use seq_puts() in imx_pinconf_dbg_show() SF Markus Elfring
2017-04-14  9:20 ` [PATCH 08/10] pinctrl: imx1-core: Use kmalloc_array() in imx_dt_node_to_map() SF Markus Elfring
2017-04-14  9:22 ` [PATCH 09/10] pinctrl: mxs: Use devm_kcalloc() in two functions SF Markus Elfring
2017-04-14  9:23 ` SF Markus Elfring [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ed0b8015-20c7-c766-624b-d34b54444d1e@users.sourceforge.net \
    --to=elfring@users.sourceforge.net \
    --cc=arnd@arndb.de \
    --cc=gary.bisson@boundarydevices.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=ldewangan@nvidia.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=paul.gortmaker@windriver.com \
    --cc=shawnguo@kernel.org \
    --cc=van.freenix@gmail.com \
    --cc=vladimir_zapolskiy@mentor.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).