From: SF Markus Elfring <elfring@users.sourceforge.net>
To: linux-hwmon@vger.kernel.org, "Günter Röck" <linux@roeck-us.net>,
"Jean Delvare" <jdelvare@suse.com>
Cc: LKML <linux-kernel@vger.kernel.org>, kernel-janitors@vger.kernel.org
Subject: [PATCH 3/4] hwmon-nct6775: Use devm_kcalloc() in nct6775_create_attr_group()
Date: Thu, 27 Apr 2017 11:30:33 +0200 [thread overview]
Message-ID: <e5dc9467-16c5-a143-f8d5-4da464cd97f6@users.sourceforge.net> (raw)
In-Reply-To: <2f58a509-4aba-5c44-bc79-568b260ab692@users.sourceforge.net>
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Thu, 27 Apr 2017 10:35:36 +0200
Multiplications for the size determination of memory allocations
indicated that array data structures should be processed.
Thus use the corresponding function "devm_kcalloc".
This issue was detected by using the Coccinelle software.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
drivers/hwmon/nct6775.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/drivers/hwmon/nct6775.c b/drivers/hwmon/nct6775.c
index 2458b406f6aa..d552ab7901a7 100644
--- a/drivers/hwmon/nct6775.c
+++ b/drivers/hwmon/nct6775.c
@@ -1073,13 +1073,12 @@ nct6775_create_attr_group(struct device *dev,
if (group == NULL)
return ERR_PTR(-ENOMEM);
- attrs = devm_kzalloc(dev, sizeof(*attrs) * (repeat * count + 1),
+ attrs = devm_kcalloc(dev, repeat * count + 1, sizeof(*attrs),
GFP_KERNEL);
if (attrs == NULL)
return ERR_PTR(-ENOMEM);
- su = devm_kzalloc(dev, sizeof(*su) * repeat * count,
- GFP_KERNEL);
+ su = devm_kcalloc(dev, repeat * count, sizeof(*su), GFP_KERNEL);
if (su == NULL)
return ERR_PTR(-ENOMEM);
--
2.12.2
next prev parent reply other threads:[~2017-04-27 9:32 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-27 9:27 [PATCH 0/4] hwmon-NCT: Fine-tuning for four function implementations SF Markus Elfring
2017-04-27 9:28 ` [PATCH 1/4] hwmon-nct6683: Use devm_kcalloc() in nct6683_create_attr_group() SF Markus Elfring
2017-04-27 9:29 ` [PATCH 2/4] hwmon-nct6683: Adjust five checks for null pointers SF Markus Elfring
2017-04-27 9:30 ` SF Markus Elfring [this message]
2017-04-27 9:31 ` [PATCH 4/4] hwmon-nct6775: Adjust seven " SF Markus Elfring
2017-04-27 12:50 ` [PATCH 0/4] hwmon-NCT: Fine-tuning for four function implementations Jean Delvare
2017-04-27 13:23 ` SF Markus Elfring
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=e5dc9467-16c5-a143-f8d5-4da464cd97f6@users.sourceforge.net \
--to=elfring@users.sourceforge.net \
--cc=jdelvare@suse.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-hwmon@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@roeck-us.net \
/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
Powered by JetHome