From: SF Markus Elfring <elfring@users.sourceforge.net>
To: Sebastian Reichel <sre@kernel.org>
Cc: LKML <linux-kernel@vger.kernel.org>, kernel-janitors@vger.kernel.org
Subject: [PATCH 1/3] HSI: nokia-modem: Use devm_kcalloc() in nokia_modem_gpio_probe()
Date: Tue, 25 Apr 2017 10:41:19 +0200 [thread overview]
Message-ID: <cfe0f4c9-bf59-8388-9695-20037ead15dc@users.sourceforge.net> (raw)
In-Reply-To: <be1a9b8a-bc9f-d96e-04b4-a6edf2dc37c6@users.sourceforge.net>
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Tue, 25 Apr 2017 09:49:22 +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".
This issue was detected by using the Coccinelle software.
* 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/hsi/clients/nokia-modem.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/hsi/clients/nokia-modem.c b/drivers/hsi/clients/nokia-modem.c
index c000780d931f..f6c97a0e1fcd 100644
--- a/drivers/hsi/clients/nokia-modem.c
+++ b/drivers/hsi/clients/nokia-modem.c
@@ -102,8 +102,8 @@ static int nokia_modem_gpio_probe(struct device *dev)
return -EINVAL;
}
- modem->gpios = devm_kzalloc(dev, gpio_count *
- sizeof(struct nokia_modem_gpio), GFP_KERNEL);
+ modem->gpios = devm_kcalloc(dev, gpio_count, sizeof(*modem->gpios),
+ GFP_KERNEL);
if (!modem->gpios) {
dev_err(dev, "Could not allocate memory for gpios\n");
return -ENOMEM;
--
2.12.2
next prev parent reply other threads:[~2017-04-25 8:41 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-25 8:40 [PATCH 0/3] HSI: nokia-modem: Fine-tuning for two function implementations SF Markus Elfring
2017-04-25 8:41 ` SF Markus Elfring [this message]
2017-04-25 8:42 ` [PATCH 2/3] HSI: nokia-modem: Delete error messages for a failed memory allocation in two functions SF Markus Elfring
2017-04-25 8:43 ` [PATCH 3/3] HSI: nokia-modem: Add a space character for better code readability in nokia_modem_probe() SF Markus Elfring
2017-05-01 9:06 ` [PATCH 0/3] HSI: nokia-modem: Fine-tuning for two function implementations Sebastian Reichel
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=cfe0f4c9-bf59-8388-9695-20037ead15dc@users.sourceforge.net \
--to=elfring@users.sourceforge.net \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=sre@kernel.org \
/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).