diff options
author | Jingoo Han <jg1.han@samsung.com> | 2013-08-20 16:04:42 +0900 |
---|---|---|
committer | Lee Jones <lee.jones@linaro.org> | 2013-08-20 08:51:23 +0100 |
commit | 0010dd3883b8a5e99c7d4093b97e9e34300a2f03 (patch) | |
tree | 7a4d53351710a58e7f03fbfbbd571de0e3e7053a /drivers/mfd/max8998.c | |
parent | 6922ffcfad1a5ff8cd0e44bbcee3686dd6caf13c (diff) | |
download | lwn-0010dd3883b8a5e99c7d4093b97e9e34300a2f03.tar.gz lwn-0010dd3883b8a5e99c7d4093b97e9e34300a2f03.zip |
mfd: max8998: Use devm_*() functions
Use devm_*() functions to make cleanup paths simpler.
Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Diffstat (limited to 'drivers/mfd/max8998.c')
-rw-r--r-- | drivers/mfd/max8998.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/drivers/mfd/max8998.c b/drivers/mfd/max8998.c index 45bffb8c7236..fe6332dcabee 100644 --- a/drivers/mfd/max8998.c +++ b/drivers/mfd/max8998.c @@ -188,7 +188,8 @@ static int max8998_i2c_probe(struct i2c_client *i2c, struct max8998_dev *max8998; int ret = 0; - max8998 = kzalloc(sizeof(struct max8998_dev), GFP_KERNEL); + max8998 = devm_kzalloc(&i2c->dev, sizeof(struct max8998_dev), + GFP_KERNEL); if (max8998 == NULL) return -ENOMEM; @@ -246,7 +247,6 @@ err: mfd_remove_devices(max8998->dev); max8998_irq_exit(max8998); i2c_unregister_device(max8998->rtc); - kfree(max8998); return ret; } @@ -257,7 +257,6 @@ static int max8998_i2c_remove(struct i2c_client *i2c) mfd_remove_devices(max8998->dev); max8998_irq_exit(max8998); i2c_unregister_device(max8998->rtc); - kfree(max8998); return 0; } |