mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 01/16] mfd: tps65912: Convert to managed resources for allocating memory
@ 2013-05-23 15:25 Lee Jones
  2013-05-23 15:25 ` [PATCH 02/16] mfd: 88pm860x: " Lee Jones
                   ` (15 more replies)
  0 siblings, 16 replies; 17+ messages in thread
From: Lee Jones @ 2013-05-23 15:25 UTC (permalink / raw)
  To: linux-kernel, sameo; +Cc: Lee Jones

Saves on code and simplifies the driver, as these resources are now
tracked and freed automatically when the driver is realised.

Signed-off-by: Lee Jones <lee.jones@linaro.org>
---
 drivers/mfd/tps65912-core.c |    2 --
 drivers/mfd/tps65912-i2c.c  |    3 ++-
 drivers/mfd/tps65912-spi.c  |    3 ++-
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/mfd/tps65912-core.c b/drivers/mfd/tps65912-core.c
index f91037a..7035743 100644
--- a/drivers/mfd/tps65912-core.c
+++ b/drivers/mfd/tps65912-core.c
@@ -161,7 +161,6 @@ int tps65912_device_init(struct tps65912 *tps65912)
 
 err:
 	mfd_remove_devices(tps65912->dev);
-	kfree(tps65912);
 	return ret;
 }
 
@@ -169,7 +168,6 @@ void tps65912_device_exit(struct tps65912 *tps65912)
 {
 	mfd_remove_devices(tps65912->dev);
 	tps65912_irq_exit(tps65912);
-	kfree(tps65912);
 }
 
 MODULE_AUTHOR("Margarita Olaya	<magi@slimlogic.co.uk>");
diff --git a/drivers/mfd/tps65912-i2c.c b/drivers/mfd/tps65912-i2c.c
index c041f2c..6a6343e 100644
--- a/drivers/mfd/tps65912-i2c.c
+++ b/drivers/mfd/tps65912-i2c.c
@@ -77,7 +77,8 @@ static int tps65912_i2c_probe(struct i2c_client *i2c,
 {
 	struct tps65912 *tps65912;
 
-	tps65912 = kzalloc(sizeof(struct tps65912), GFP_KERNEL);
+	tps65912 = devm_kzalloc(&i2c->dev,
+				sizeof(struct tps65912), GFP_KERNEL);
 	if (tps65912 == NULL)
 		return -ENOMEM;
 
diff --git a/drivers/mfd/tps65912-spi.c b/drivers/mfd/tps65912-spi.c
index b45f460..69a5178 100644
--- a/drivers/mfd/tps65912-spi.c
+++ b/drivers/mfd/tps65912-spi.c
@@ -85,7 +85,8 @@ static int tps65912_spi_probe(struct spi_device *spi)
 {
 	struct tps65912 *tps65912;
 
-	tps65912 = kzalloc(sizeof(struct tps65912), GFP_KERNEL);
+	tps65912 = devm_kzalloc(&spi->dev,
+				sizeof(struct tps65912), GFP_KERNEL);
 	if (tps65912 == NULL)
 		return -ENOMEM;
 
-- 
1.7.10.4


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

end of thread, other threads:[~2013-06-11 18:20 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-05-23 15:25 [PATCH 01/16] mfd: tps65912: Convert to managed resources for allocating memory Lee Jones
2013-05-23 15:25 ` [PATCH 02/16] mfd: 88pm860x: " Lee Jones
2013-05-23 15:25 ` [PATCH 03/16] mfd: ab3100-otp: " Lee Jones
2013-05-23 15:25 ` [PATCH 04/16] mfd: ab8500-debug: " Lee Jones
2013-05-23 15:25 ` [PATCH 05/16] mfd: ab8500-gpadc: " Lee Jones
2013-05-23 15:25 ` [PATCH 06/16] mfd: abx500-core: " Lee Jones
2013-05-23 15:25 ` [PATCH 07/16] mfd: adp5520: " Lee Jones
2013-05-23 15:25 ` [PATCH 08/16] mfd: asic3: " Lee Jones
2013-05-23 15:25 ` [PATCH 09/16] mfd: cros_ec: " Lee Jones
2013-05-23 15:25 ` [PATCH 10/16] mfd: davinci_voicecodec: " Lee Jones
2013-05-23 15:25 ` [PATCH 11/16] mfd: htc-egpio: " Lee Jones
2013-05-23 15:25 ` [PATCH 12/16] mfd: htc-i2cpld: " Lee Jones
2013-05-23 15:25 ` [PATCH 13/16] mfd: htc-pasic3: " Lee Jones
2013-05-23 15:25 ` [PATCH 14/16] mfd: janz-cmodio: " Lee Jones
2013-05-23 15:25 ` [PATCH 15/16] mfd: max77686: " Lee Jones
2013-05-23 15:25 ` [PATCH 16/16] mfd: max8925: " Lee Jones
2013-06-11 18:19 ` [PATCH 01/16] mfd: tps65912: " Samuel Ortiz

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

all inboxes | Powered by JetHome®