mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* mfd: tps6586x - free allocated resources when unload the module
@ 2010-08-23  3:33 Axel Lin
  2010-09-10 15:41 ` Samuel Ortiz
  0 siblings, 1 reply; 2+ messages in thread
From: Axel Lin @ 2010-08-23  3:33 UTC (permalink / raw)
  To: linux-kernel; +Cc: Samuel Ortiz, Mike Rapoport

For the resources allocated in tps6586x_i2c_probe(),
we need to free it in tps6586x_i2c_remove().

Signed-off-by: Axel Lin <axel.lin@gmail.com>
---
 drivers/mfd/tps6586x.c |   15 +++++++++++++++
 1 files changed, 15 insertions(+), 0 deletions(-)

diff --git a/drivers/mfd/tps6586x.c b/drivers/mfd/tps6586x.c
index 4cde31e..6eb2730 100644
--- a/drivers/mfd/tps6586x.c
+++ b/drivers/mfd/tps6586x.c
@@ -338,6 +338,21 @@ err_add_devs:
 
 static int __devexit tps6586x_i2c_remove(struct i2c_client *client)
 {
+	struct tps6586x *tps6586x = i2c_get_clientdata(client);
+	struct tps6586x_platform_data *pdata = client->dev.platform_data;
+	int ret;
+
+	if (pdata->gpio_base) {
+		ret = gpiochip_remove(&tps6586x->gpio);
+		if (ret) {
+			dev_err(&client->dev, "Can't remove gpio chip: %d\n",
+				ret);
+			return ret;
+		}
+	}
+
+	tps6586x_remove_subdevs(tps6586x);
+	kfree(tps6586x);
 	return 0;
 }
 
-- 
1.7.2




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

* Re: mfd: tps6586x - free allocated resources when unload the module
  2010-08-23  3:33 mfd: tps6586x - free allocated resources when unload the module Axel Lin
@ 2010-09-10 15:41 ` Samuel Ortiz
  0 siblings, 0 replies; 2+ messages in thread
From: Samuel Ortiz @ 2010-09-10 15:41 UTC (permalink / raw)
  To: Axel Lin; +Cc: linux-kernel, Mike Rapoport

Hi Axel,

On Mon, Aug 23, 2010 at 11:33:00AM +0800, Axel Lin wrote:
> For the resources allocated in tps6586x_i2c_probe(),
> we need to free it in tps6586x_i2c_remove().
Thanks, patch applied.

Cheers,
Samuel.

-- 
Intel Open Source Technology Centre
http://oss.intel.com/

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

end of thread, other threads:[~2010-09-10 15:41 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-08-23  3:33 mfd: tps6586x - free allocated resources when unload the module Axel Lin
2010-09-10 15:41 ` Samuel Ortiz

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