Skip to content

Commit

Permalink
mfd: Free tps6586x allocated resources when unload the module
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Axel Lin authored and Samuel Ortiz committed Oct 28, 2010
1 parent e7944d8 commit 4b751cf
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions drivers/mfd/tps6586x.c
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,19 @@ static int __devinit tps6586x_i2c_probe(struct i2c_client *client,

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;
}

Expand Down

0 comments on commit 4b751cf

Please sign in to comment.