From: Axel Lin <axel.lin@gmail.com>
To: linux-kernel <linux-kernel@vger.kernel.org>
Cc: Samuel Ortiz <sameo@linux.intel.com>,
Mike Rapoport <mike@compulab.co.il>
Subject: mfd: tps6586x - free allocated resources when unload the module
Date: Mon, 23 Aug 2010 11:33:00 +0800 [thread overview]
Message-ID: <1282534380.2281.3.camel@mola> (raw)
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
next reply other threads:[~2010-08-23 3:30 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-08-23 3:33 Axel Lin [this message]
2010-09-10 15:41 ` Samuel Ortiz
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1282534380.2281.3.camel@mola \
--to=axel.lin@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mike@compulab.co.il \
--cc=sameo@linux.intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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