public inbox for kernel-janitors@vger.kernel.org
 help / color / mirror / Atom feed
From: SF Markus Elfring <elfring@users.sourceforge.net>
To: patches@opensource.wolfsonmicro.com,
	Chanwoo Choi <cw00.choi@samsung.com>,
	Charles Keepax <ckeepax@opensource.wolfsonmicro.com>,
	MyungJoo Ham <myungjoo.ham@samsung.com>
Cc: LKML <linux-kernel@vger.kernel.org>, kernel-janitors@vger.kernel.org
Subject: [PATCH 3/3] extcon: arizona: Use devm_kcalloc() in arizona_extcon_get_micd_configs()
Date: Mon, 24 Apr 2017 12:43:55 +0000	[thread overview]
Message-ID: <1a203761-76b9-bf3c-c034-0bb81fe6006a@users.sourceforge.net> (raw)
In-Reply-To: <b650292b-4f5f-c50d-f0a3-604ba26bcbef@users.sourceforge.net>

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sun, 23 Apr 2017 22:44:19 +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_kcalloc".

* Replace the specification of a data structure by a pointer dereference
  to make the corresponding size determination a bit safer according to
  the Linux coding style convention.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/extcon/extcon-arizona.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/extcon/extcon-arizona.c b/drivers/extcon/extcon-arizona.c
index e2d78cd7030d..f84da4a17724 100644
--- a/drivers/extcon/extcon-arizona.c
+++ b/drivers/extcon/extcon-arizona.c
@@ -1271,9 +1271,7 @@ static int arizona_extcon_get_micd_configs(struct device *dev,
 		goto out;
 
 	nconfs /= entries_per_config;
-
-	micd_configs = devm_kzalloc(dev,
-				    nconfs * sizeof(struct arizona_micd_range),
+	micd_configs = devm_kcalloc(dev, nconfs, sizeof(*micd_configs),
 				    GFP_KERNEL);
 	if (!micd_configs) {
 		ret = -ENOMEM;
-- 
2.12.2


  parent reply	other threads:[~2017-04-24 12:43 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20170424123857epcas2p24390d04885c9fc4c1980838ed8a4db06@epcas2p2.samsung.com>
2017-04-24 12:38 ` [PATCH 0/3] Extcon: Fine-tuning for three functions SF Markus Elfring
2017-04-24 12:40   ` [PATCH 1/3] extcon: Use devm_kcalloc() in extcon_dev_register() SF Markus Elfring
2017-04-24 12:41   ` [PATCH 2/3] extcon: Fix a typo in three comment lines SF Markus Elfring
2017-04-24 12:43   ` SF Markus Elfring [this message]
2017-04-24 12:59     ` [PATCH 3/3] extcon: arizona: Use devm_kcalloc() in arizona_extcon_get_micd_configs() Charles Keepax
2017-04-24 13:34       ` SF Markus Elfring
2017-04-26  8:01         ` Charles Keepax
2017-05-23  9:34   ` [PATCH 0/3] Extcon: Fine-tuning for three functions Chanwoo Choi

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=1a203761-76b9-bf3c-c034-0bb81fe6006a@users.sourceforge.net \
    --to=elfring@users.sourceforge.net \
    --cc=ckeepax@opensource.wolfsonmicro.com \
    --cc=cw00.choi@samsung.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=myungjoo.ham@samsung.com \
    --cc=patches@opensource.wolfsonmicro.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