Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1642467 > unrolled thread

[PATCH 2/2] regulator: fixed: Improve a size determination in two functions

Started bySF Markus Elfring <elfring@users.sourceforge.net>
First post2017-05-16 14:10 +0200
Last post2017-05-16 14:10 +0200
Articles 1 — 1 participant

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH 2/2] regulator: fixed: Improve a size determination in two  functions SF Markus Elfring <elfring@users.sourceforge.net> - 2017-05-16 14:10 +0200

#1642467 — [PATCH 2/2] regulator: fixed: Improve a size determination in two functions

FromSF Markus Elfring <elfring@users.sourceforge.net>
Date2017-05-16 14:10 +0200
Subject[PATCH 2/2] regulator: fixed: Improve a size determination in two functions
Message-ID<tHJsB-5rS-5@gated-at.bofh.it>
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

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web