From: SF Markus Elfring <elfring@users.sourceforge.net>
To: Liam Girdwood <lgirdwood@gmail.com>,
Mark Brown <broonie@kernel.org>,
kernel-janitors@vger.kernel.org
Cc: LKML <linux-kernel@vger.kernel.org>
Subject: [PATCH 2/2] regulator: fixed: Improve a size determination in two functions
Date: Tue, 16 May 2017 14:08:47 +0200 [thread overview]
Message-ID: <481ddb47-4d4d-6acc-ed31-f66079483179@users.sourceforge.net> (raw)
In-Reply-To: <83b84f24-503b-4b45-3e4d-9c88c6b0252b@users.sourceforge.net>
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Tue, 16 May 2017 13:43:11 +0200
Replace the specification of two data structures by pointer dereferences
as the parameter for the operator "sizeof" 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/regulator/fixed.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/regulator/fixed.c b/drivers/regulator/fixed.c
index a947f357d0f8..c33e930c9587 100644
--- a/drivers/regulator/fixed.c
+++ b/drivers/regulator/fixed.c
@@ -54,8 +54,7 @@ of_get_fixed_voltage_config(struct device *dev,
struct device_node *np = dev->of_node;
struct regulator_init_data *init_data;
- config = devm_kzalloc(dev, sizeof(struct fixed_voltage_config),
- GFP_KERNEL);
+ config = devm_kzalloc(dev, sizeof(*config), GFP_KERNEL);
if (!config)
return ERR_PTR(-ENOMEM);
@@ -104,8 +103,7 @@ static int reg_fixed_voltage_probe(struct platform_device *pdev)
struct regulator_config cfg = { };
int ret;
- drvdata = devm_kzalloc(&pdev->dev, sizeof(struct fixed_voltage_data),
- GFP_KERNEL);
+ drvdata = devm_kzalloc(&pdev->dev, sizeof(*drvdata), GFP_KERNEL);
if (!drvdata)
return -ENOMEM;
--
2.13.0
next prev parent reply other threads:[~2017-05-16 12:08 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-16 12:06 [PATCH 0/2] Fixed voltage regulator: Adjustments for two function implementations SF Markus Elfring
2017-05-16 12:07 ` [PATCH 1/2] regulator: fixed: Delete error messages for failed memory allocations in reg_fixed_voltage_probe() SF Markus Elfring
2017-05-16 12:08 ` SF Markus Elfring [this message]
2017-12-14 13:21 ` [PATCH 0/2] Fixed voltage regulator: Adjustments for two function implementations SF Markus Elfring
2017-12-14 15:09 ` Mark Brown
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=481ddb47-4d4d-6acc-ed31-f66079483179@users.sourceforge.net \
--to=elfring@users.sourceforge.net \
--cc=broonie@kernel.org \
--cc=kernel-janitors@vger.kernel.org \
--cc=lgirdwood@gmail.com \
--cc=linux-kernel@vger.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
all inboxes | Powered by JetHome®