From: SF Markus Elfring <elfring@users.sourceforge.net>
To: linux-pm@vger.kernel.org, linux-omap@vger.kernel.org,
Eduardo Valentin <edubezval@gmail.com>,
Keerthy <j-keerthy@ti.com>, Zhang Rui <rui.zhang@intel.com>
Cc: LKML <linux-kernel@vger.kernel.org>, kernel-janitors@vger.kernel.org
Subject: [PATCH 1/3] ti-soc-thermal: Use devm_kcalloc() in ti_bandgap_build()
Date: Wed, 26 Apr 2017 17:34:45 +0200 [thread overview]
Message-ID: <071d2e92-0bcc-5ccc-ad28-b05a72538d6b@users.sourceforge.net> (raw)
In-Reply-To: <cd524803-b771-c3d2-8906-ee78576c86d4@users.sourceforge.net>
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Wed, 26 Apr 2017 16:45:25 +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.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
drivers/thermal/ti-soc-thermal/ti-bandgap.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/thermal/ti-soc-thermal/ti-bandgap.c b/drivers/thermal/ti-soc-thermal/ti-bandgap.c
index ba9c302454fb..f19cb7612a65 100644
--- a/drivers/thermal/ti-soc-thermal/ti-bandgap.c
+++ b/drivers/thermal/ti-soc-thermal/ti-bandgap.c
@@ -1224,8 +1224,8 @@ static struct ti_bandgap *ti_bandgap_build(struct platform_device *pdev)
bgp->conf = of_id->data;
/* register shadow for context save and restore */
- bgp->regval = devm_kzalloc(&pdev->dev, sizeof(*bgp->regval) *
- bgp->conf->sensor_count, GFP_KERNEL);
+ bgp->regval = devm_kcalloc(&pdev->dev, bgp->conf->sensor_count,
+ sizeof(*bgp->regval), GFP_KERNEL);
if (!bgp->regval) {
dev_err(&pdev->dev, "Unable to allocate mem for driver ref\n");
return ERR_PTR(-ENOMEM);
--
2.12.2
next prev parent reply other threads:[~2017-04-26 15:36 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-26 15:33 [PATCH 0/3] TI-SoC-thermal: Fine-tuning for two functions SF Markus Elfring
2017-04-26 15:34 ` SF Markus Elfring [this message]
2017-05-02 3:55 ` [PATCH 1/3] ti-soc-thermal: Use devm_kcalloc() in ti_bandgap_build() Keerthy
2017-04-26 15:37 ` [PATCH 2/3] ti-soc-thermal: Delete error messages for failed memory allocations " SF Markus Elfring
2017-05-02 3:52 ` Keerthy
2017-04-26 15:39 ` [PATCH 3/3] ti-soc-thermal: Fix a typo in a comment line SF Markus Elfring
2017-05-02 3:51 ` Keerthy
2017-04-27 16:20 ` [PATCH 0/3] TI-SoC-thermal: Fine-tuning for two functions Eduardo Valentin
2017-05-01 5:20 ` Keerthy
2017-05-02 4:55 ` Keerthy
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=071d2e92-0bcc-5ccc-ad28-b05a72538d6b@users.sourceforge.net \
--to=elfring@users.sourceforge.net \
--cc=edubezval@gmail.com \
--cc=j-keerthy@ti.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-omap@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=rui.zhang@intel.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).