mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] regulator: tps6586x: Remove unnecessary rdev[] array
@ 2014-03-08 13:15 Axel Lin
  2014-03-13 11:42 ` Mark Brown
  0 siblings, 1 reply; 2+ messages in thread
From: Axel Lin @ 2014-03-08 13:15 UTC (permalink / raw)
  To: Mark Brown; +Cc: Stefan Agner, Laxman Dewangan, Liam Girdwood, linux-kernel

Now we are using devm_regulator_register(), so we don't need the rdev[] array
to store return value of devm_regulator_register. Use a *rdev variable is
enough for checking return status.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
---
 drivers/regulator/tps6586x-regulator.c | 14 ++++----------
 1 file changed, 4 insertions(+), 10 deletions(-)

diff --git a/drivers/regulator/tps6586x-regulator.c b/drivers/regulator/tps6586x-regulator.c
index e36f3569..32f38a6 100644
--- a/drivers/regulator/tps6586x-regulator.c
+++ b/drivers/regulator/tps6586x-regulator.c
@@ -396,7 +396,7 @@ static int tps6586x_regulator_probe(struct platform_device *pdev)
 {
 	struct tps6586x_regulator *ri = NULL;
 	struct regulator_config config = { };
-	struct regulator_dev **rdev;
+	struct regulator_dev *rdev;
 	struct regulator_init_data *reg_data;
 	struct tps6586x_platform_data *pdata;
 	struct of_regulator_match *tps6586x_reg_matches = NULL;
@@ -416,11 +416,6 @@ static int tps6586x_regulator_probe(struct platform_device *pdev)
 		return -ENODEV;
 	}
 
-	rdev = devm_kzalloc(&pdev->dev, TPS6586X_ID_MAX_REGULATOR *
-				sizeof(*rdev), GFP_KERNEL);
-	if (!rdev)
-		return -ENOMEM;
-
 	version = tps6586x_get_version(pdev->dev.parent);
 
 	for (id = 0; id < TPS6586X_ID_MAX_REGULATOR; ++id) {
@@ -447,12 +442,11 @@ static int tps6586x_regulator_probe(struct platform_device *pdev)
 		if (tps6586x_reg_matches)
 			config.of_node = tps6586x_reg_matches[id].of_node;
 
-		rdev[id] = devm_regulator_register(&pdev->dev, &ri->desc,
-						   &config);
-		if (IS_ERR(rdev[id])) {
+		rdev = devm_regulator_register(&pdev->dev, &ri->desc, &config);
+		if (IS_ERR(rdev)) {
 			dev_err(&pdev->dev, "failed to register regulator %s\n",
 					ri->desc.name);
-			return PTR_ERR(rdev[id]);
+			return PTR_ERR(rdev);
 		}
 
 		if (reg_data) {
-- 
1.8.1.2




^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] regulator: tps6586x: Remove unnecessary rdev[] array
  2014-03-08 13:15 [PATCH] regulator: tps6586x: Remove unnecessary rdev[] array Axel Lin
@ 2014-03-13 11:42 ` Mark Brown
  0 siblings, 0 replies; 2+ messages in thread
From: Mark Brown @ 2014-03-13 11:42 UTC (permalink / raw)
  To: Axel Lin; +Cc: Stefan Agner, Laxman Dewangan, Liam Girdwood, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 269 bytes --]

On Sat, Mar 08, 2014 at 09:15:59PM +0800, Axel Lin wrote:
> Now we are using devm_regulator_register(), so we don't need the rdev[] array
> to store return value of devm_regulator_register. Use a *rdev variable is
> enough for checking return status.

Applied, thanks.

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-03-13 11:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-03-08 13:15 [PATCH] regulator: tps6586x: Remove unnecessary rdev[] array Axel Lin
2014-03-13 11:42 ` Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome