From 4b751cf5de975a91246110f3da1299f9e466646d Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Tue, 24 Aug 2010 15:18:58 +0800 Subject: mfd: Free tps6586x allocated resources when unload the module For the resources allocated in tps6586x_i2c_probe(), we need to free it in tps6586x_i2c_remove(). Signed-off-by: Axel Lin Signed-off-by: Samuel Ortiz --- drivers/mfd/tps6586x.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'drivers/mfd/tps6586x.c') diff --git a/drivers/mfd/tps6586x.c b/drivers/mfd/tps6586x.c index 4cde31e6a252..bc6587194de9 100644 --- a/drivers/mfd/tps6586x.c +++ b/drivers/mfd/tps6586x.c @@ -338,6 +338,19 @@ 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); + } + + tps6586x_remove_subdevs(tps6586x); + kfree(tps6586x); return 0; } -- cgit v1.2.3