All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] regulator: gpio-regulator: Sort in Makefile
@ 2012-04-03 22:23 Mark Brown
  2012-04-03 22:23 ` [PATCH 2/2] regulator: gpio-regulator: Basic devm_kzalloc() conversion Mark Brown
  0 siblings, 1 reply; 4+ messages in thread
From: Mark Brown @ 2012-04-03 22:23 UTC (permalink / raw)
  To: Heiko Stuebner, Liam Girdwood; +Cc: linux-kernel, Mark Brown

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
---
 drivers/regulator/Makefile |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/regulator/Makefile b/drivers/regulator/Makefile
index 2cc91d1..04ff3ea 100644
--- a/drivers/regulator/Makefile
+++ b/drivers/regulator/Makefile
@@ -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
-- 
1.7.9.1


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

* [PATCH 2/2] regulator: gpio-regulator: Basic devm_kzalloc() conversion
  2012-04-03 22:23 [PATCH 1/2] regulator: gpio-regulator: Sort in Makefile Mark Brown
@ 2012-04-03 22:23 ` Mark Brown
  2012-04-04  6:50   ` Wolfram Sang
  0 siblings, 1 reply; 4+ messages in thread
From: Mark Brown @ 2012-04-03 22:23 UTC (permalink / raw)
  To: Heiko Stuebner, Liam Girdwood; +Cc: linux-kernel, Mark Brown

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

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
---
 drivers/regulator/gpio-regulator.c |    5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/regulator/gpio-regulator.c b/drivers/regulator/gpio-regulator.c
index 5f9b6ad..ad0fc78 100644
--- a/drivers/regulator/gpio-regulator.c
+++ b/drivers/regulator/gpio-regulator.c
@@ -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;
 }
-- 
1.7.9.1


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

* Re: [PATCH 2/2] regulator: gpio-regulator: Basic devm_kzalloc() conversion
  2012-04-03 22:23 ` [PATCH 2/2] regulator: gpio-regulator: Basic devm_kzalloc() conversion Mark Brown
@ 2012-04-04  6:50   ` Wolfram Sang
  2012-04-04  9:45     ` Mark Brown
  0 siblings, 1 reply; 4+ messages in thread
From: Wolfram Sang @ 2012-04-04  6:50 UTC (permalink / raw)
  To: Mark Brown; +Cc: Heiko Stuebner, Liam Girdwood, linux-kernel

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

On Tue, Apr 03, 2012 at 11:23:09PM +0100, Mark Brown wrote:
> 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

-- 
Pengutronix e.K.                           | Wolfram Sang                |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |

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

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

* Re: [PATCH 2/2] regulator: gpio-regulator: Basic devm_kzalloc() conversion
  2012-04-04  6:50   ` Wolfram Sang
@ 2012-04-04  9:45     ` Mark Brown
  0 siblings, 0 replies; 4+ messages in thread
From: Mark Brown @ 2012-04-04  9:45 UTC (permalink / raw)
  To: Wolfram Sang; +Cc: Heiko Stuebner, Liam Girdwood, linux-kernel

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

On Wed, Apr 04, 2012 at 08:50:15AM +0200, Wolfram Sang wrote:
> On Tue, Apr 03, 2012 at 11:23:09PM +0100, Mark Brown wrote:
> > 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...

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

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

end of thread, other threads:[~2012-04-04  9:45 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-04-03 22:23 [PATCH 1/2] regulator: gpio-regulator: Sort in Makefile Mark Brown
2012-04-03 22:23 ` [PATCH 2/2] regulator: gpio-regulator: Basic devm_kzalloc() conversion Mark Brown
2012-04-04  6:50   ` Wolfram Sang
2012-04-04  9:45     ` Mark Brown

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.