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


Groups > linux.kernel > #1321011 > unrolled thread

[PATCH 2/2] regulator: gpio: Move last remaining memory allocation to devres

Started byHarald Geyer <harald@ccbib.org>
First post2016-01-28 21:10 +0100
Last post2016-01-28 21:10 +0100
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: gpio: Move last remaining memory allocation to devres Harald Geyer <harald@ccbib.org> - 2016-01-28 21:10 +0100

#1321011 — [PATCH 2/2] regulator: gpio: Move last remaining memory allocation to devres

FromHarald Geyer <harald@ccbib.org>
Date2016-01-28 21:10 +0100
Subject[PATCH 2/2] regulator: gpio: Move last remaining memory allocation to devres
Message-ID<qW13b-a7-1@gated-at.bofh.it>
Simple cleanup without functional changes.

Signed-off-by: Harald Geyer <harald@ccbib.org>
---
 drivers/regulator/gpio-regulator.c | 14 +++++---------
 1 file changed, 5 insertions(+), 9 deletions(-)

diff --git a/drivers/regulator/gpio-regulator.c b/drivers/regulator/gpio-regulator.c
index 5e2e14d..5fe4921 100644
--- a/drivers/regulator/gpio-regulator.c
+++ b/drivers/regulator/gpio-regulator.c
@@ -263,11 +263,11 @@ static int gpio_regulator_probe(struct platform_device *pdev)
 			return PTR_ERR(config);
 	}
 
-	drvdata->desc.name = kstrdup(config->supply_name, GFP_KERNEL);
+	drvdata->desc.name = devm_kstrdup(&pdev->dev, config->supply_name,
+					  GFP_KERNEL);
 	if (drvdata->desc.name == NULL) {
 		dev_err(&pdev->dev, "Failed to allocate supply name\n");
-		ret = -ENOMEM;
-		goto err;
+		return -ENOMEM;
 	}
 
 	if (config->nr_gpios != 0) {
@@ -278,7 +278,7 @@ static int gpio_regulator_probe(struct platform_device *pdev)
 		if (ret) {
 			dev_err(&pdev->dev,
 			"Could not obtain regulator setting GPIOs: %d\n", ret);
-			goto err_name;
+			return ret;
 		}
 	}
 
@@ -348,9 +348,7 @@ static int gpio_regulator_probe(struct platform_device *pdev)
 
 err_gpio:
 	gpio_free_array(drvdata->gpios, drvdata->nr_gpios);
-err_name:
-	kfree(drvdata->desc.name);
-err:
+
 	return ret;
 }
 
@@ -362,8 +360,6 @@ static int gpio_regulator_remove(struct platform_device *pdev)
 
 	gpio_free_array(drvdata->gpios, drvdata->nr_gpios);
 
-	kfree(drvdata->desc.name);
-
 	return 0;
 }
 
-- 
2.1.4

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web