summaryrefslogtreecommitdiff
path: root/drivers/mfd
diff options
context:
space:
mode:
authorLaxman Dewangan <ldewangan@nvidia.com>2012-07-19 14:05:52 +0530
committerSimone Willett <swillett@nvidia.com>2012-07-23 10:40:12 -0700
commite6a836a6312c24e98ccb0fe059a569470b9de32d (patch)
treec3a4df9e944fcde1761ebf5b6916a3a0926c580b /drivers/mfd
parent483d3d78b86237c86afc915615130021e5468162 (diff)
mfd: tps80031: use devm managed resources
Allocate memory for device state using devm_kzalloc() to simplify accounting and letting the kernel do the garbage-collection. Change-Id: I8dcde205556c43f4fdfe5e335507df206f204177 Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com> Reviewed-on: http://git-master/r/117331 Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: Bitan Biswas <bbiswas@nvidia.com> GVS: Gerrit_Virtual_Submit
Diffstat (limited to 'drivers/mfd')
-rw-r--r--drivers/mfd/tps80031.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/drivers/mfd/tps80031.c b/drivers/mfd/tps80031.c
index 047c3801ea85..5b287eb12241 100644
--- a/drivers/mfd/tps80031.c
+++ b/drivers/mfd/tps80031.c
@@ -1209,7 +1209,6 @@ static int __devexit tps80031_i2c_remove(struct i2c_client *client)
mutex_destroy(&tps->lock);
}
- kfree(tps80031);
return 0;
}
@@ -1246,9 +1245,11 @@ static int __devinit tps80031_i2c_probe(struct i2c_client *client,
dev_info(&client->dev, "Jtag version 0x%02x and Eeprom version 0x%02x\n",
jtag_ver, ep_ver);
- tps80031 = kzalloc(sizeof(struct tps80031), GFP_KERNEL);
- if (tps80031 == NULL)
+ tps80031 = devm_kzalloc(&client->dev, sizeof(*tps80031), GFP_KERNEL);
+ if (!tps80031) {
+ dev_err(&client->dev, "Memory alloc for tps80031 failed\n");
return -ENOMEM;
+ }
tps80031->es_version = jtag_ver;
tps80031->dev = &client->dev;