diff options
author | Axel Lin <axel.lin@gmail.com> | 2010-08-24 03:18:58 -0400 |
---|---|---|
committer | Samuel Ortiz <sameo@linux.intel.com> | 2010-10-28 18:28:53 -0400 |
commit | 4b751cf5de975a91246110f3da1299f9e466646d (patch) | |
tree | a20e81c0be2bddf9a2db6b6592a2f232a8642006 /drivers/mfd/tps6586x.c | |
parent | e7944d820b1e13a5b17c3047e033bf744bcf01f1 (diff) |
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 <axel.lin@gmail.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Diffstat (limited to 'drivers/mfd/tps6586x.c')
-rw-r--r-- | drivers/mfd/tps6586x.c | 13 |
1 files changed, 13 insertions, 0 deletions
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: | |||
338 | 338 | ||
339 | static int __devexit tps6586x_i2c_remove(struct i2c_client *client) | 339 | static int __devexit tps6586x_i2c_remove(struct i2c_client *client) |
340 | { | 340 | { |
341 | struct tps6586x *tps6586x = i2c_get_clientdata(client); | ||
342 | struct tps6586x_platform_data *pdata = client->dev.platform_data; | ||
343 | int ret; | ||
344 | |||
345 | if (pdata->gpio_base) { | ||
346 | ret = gpiochip_remove(&tps6586x->gpio); | ||
347 | if (ret) | ||
348 | dev_err(&client->dev, "Can't remove gpio chip: %d\n", | ||
349 | ret); | ||
350 | } | ||
351 | |||
352 | tps6586x_remove_subdevs(tps6586x); | ||
353 | kfree(tps6586x); | ||
341 | return 0; | 354 | return 0; |
342 | } | 355 | } |
343 | 356 | ||