lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Thu, 28 Jan 2016 19:55:18 +0000
From:	Harald Geyer <harald@...ib.org>
To:	Liam Girdwood <lgirdwood@...il.com>,
	Mark Brown <broonie@...nel.org>,
	Heiko Stuebner <heiko@...ech.de>
Cc:	linux-kernel@...r.kernel.org, Harald Geyer <harald@...ib.org>
Subject: [PATCH 2/2] regulator: gpio: Move last remaining memory allocation to devres

Simple cleanup without functional changes.

Signed-off-by: Harald Geyer <harald@...ib.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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ