Skip to contentSkip to conversation

regulator: gpio-regulator: Sort in Makefile

PATCH In review Mark Brown 2 participants 4 messages Apr 3, 2012 – Apr 4, 2012 Voltage and current regulator framework

lore
Share & tools
lore

Mark Brown

author
#0 lore raw

PATCH 1/2 regulator: gpio-regulator: Sort in Makefile

---
 drivers/regulator/Makefile |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/regulator/Makefile +1 -1
index 2cc91d1..04ff3ea 100644
@@ -9,7 +9,6 @@ obj-$(CONFIG_REGULATOR_FIXED_VOLTAGE) += fixed.o
 obj-$(CONFIG_REGULATOR_VIRTUAL_CONSUMER) += virtual.o
 obj-$(CONFIG_REGULATOR_USERSPACE_CONSUMER) += userspace-consumer.o
 
-obj-$(CONFIG_REGULATOR_GPIO) += gpio-regulator.o
 obj-$(CONFIG_REGULATOR_88PM8607) += 88pm8607.o
 obj-$(CONFIG_REGULATOR_AAT2870) += aat2870-regulator.o
 obj-$(CONFIG_REGULATOR_AB3100) += ab3100.o
@@ -20,6 +19,7 @@ obj-$(CONFIG_REGULATOR_DA903X)	+= da903x.o
 obj-$(CONFIG_REGULATOR_DA9052)	+= da9052-regulator.o
 obj-$(CONFIG_REGULATOR_DBX500_PRCMU) += dbx500-prcmu.o
 obj-$(CONFIG_REGULATOR_DB8500_PRCMU) += db8500-prcmu.o
+obj-$(CONFIG_REGULATOR_GPIO) += gpio-regulator.o
 obj-$(CONFIG_REGULATOR_ISL6271A) += isl6271a-regulator.o
 obj-$(CONFIG_REGULATOR_LP3971) += lp3971.o
 obj-$(CONFIG_REGULATOR_LP3972) += lp3972.o
Signature · 1 line
1.7.9.1
author
#1 lore raw

PATCH 2/2 regulator: gpio-regulator: Basic devm_kzalloc() conversion

There's some other allocations but they're not so trivial as they use kmemdup() and kstrdup().

---
 drivers/regulator/gpio-regulator.c |    5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)
drivers/regulator/gpio-regulator.c +2 -3
index 5f9b6ad..ad0fc78 100644
@@ -174,7 +174,8 @@ static int __devinit gpio_regulator_probe(struct platform_device *pdev)
 	struct gpio_regulator_data *drvdata;
 	int ptr, ret, state;
 
-	drvdata = kzalloc(sizeof(struct gpio_regulator_data), GFP_KERNEL);
+	drvdata = devm_kzalloc(&pdev->dev, sizeof(struct gpio_regulator_data),
+			       GFP_KERNEL);
 	if (drvdata == NULL) {
 		dev_err(&pdev->dev, "Failed to allocate device data\n");
 		return -ENOMEM;
@@ -307,7 +308,6 @@ err_memgpio:
 err_name:
 	kfree(drvdata->desc.name);
 err:
-	kfree(drvdata);
 	return ret;
 }
 
@@ -326,7 +326,6 @@ static int __devexit gpio_regulator_remove(struct platform_device *pdev)
 		gpio_free(drvdata->enable_gpio);
 
 	kfree(drvdata->desc.name);
-	kfree(drvdata);
 
 	return 0;
 }
Signature · 1 line
1.7.9.1
#2 lore raw

Re: [PATCH 2/2] regulator: gpio-regulator: Basic devm_kzalloc() conversion

Quoted 2 lines · Mark Brown

There's some other allocations but they're not so trivial as they use kmemdup() and kstrdup().

What do we gain then? I wonder if it is worth fixing one occasion if we can't fix the others (yet).

Regards,

Wolfram

Signature · 2 lines
Pengutronix e.K.                           | Wolfram Sang                |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
author
#3 lore raw

Re: [PATCH 2/2] regulator: gpio-regulator: Basic devm_kzalloc() conversion

Quoted 6 lines · Wolfram Sang
Quoted 2 lines · Mark Brown

There's some other allocations but they're not so trivial as they use kmemdup() and kstrdup().

What do we gain then? I wonder if it is worth fixing one occasion if we can't fix the others (yet).

I probably wouldn't have bothered if I'd noticed the other allocations before I wrote the code but as I'd already written the code...