diff options
author | Guenter Roeck <linux@roeck-us.net> | 2012-02-22 20:56:43 +0400 |
---|---|---|
committer | Guenter Roeck <guenter.roeck@ericsson.com> | 2012-03-19 05:27:45 +0400 |
commit | 8b313ca7f1b98263ce22519b25a9c2a362eeb898 (patch) | |
tree | 36c4e576662996be3fcac1f34d339dcd53e569e3 /drivers/hwmon/pmbus/adm1275.c | |
parent | 07404aab52f5106ec436692474cf8f40978f5dac (diff) | |
download | linux-8b313ca7f1b98263ce22519b25a9c2a362eeb898.tar.xz |
hwmon: (pmbus) Convert pmbus drivers to use devm_kzalloc
Marginally less code and eliminate the possibility of memory leaks.
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Diffstat (limited to 'drivers/hwmon/pmbus/adm1275.c')
-rw-r--r-- | drivers/hwmon/pmbus/adm1275.c | 16 |
1 files changed, 3 insertions, 13 deletions
diff --git a/drivers/hwmon/pmbus/adm1275.c b/drivers/hwmon/pmbus/adm1275.c index fe52c3cf87ba..f81cb4adaeba 100644 --- a/drivers/hwmon/pmbus/adm1275.c +++ b/drivers/hwmon/pmbus/adm1275.c @@ -229,7 +229,8 @@ static int adm1275_probe(struct i2c_client *client, if (device_config < 0) return device_config; - data = kzalloc(sizeof(struct adm1275_data), GFP_KERNEL); + data = devm_kzalloc(&client->dev, sizeof(struct adm1275_data), + GFP_KERNEL); if (!data) return -ENOMEM; @@ -297,23 +298,12 @@ static int adm1275_probe(struct i2c_client *client, break; } - ret = pmbus_do_probe(client, id, info); - if (ret) - goto err_mem; - return 0; - -err_mem: - kfree(data); - return ret; + return pmbus_do_probe(client, id, info); } static int adm1275_remove(struct i2c_client *client) { - const struct pmbus_driver_info *info = pmbus_get_driver_info(client); - const struct adm1275_data *data = to_adm1275_data(info); - pmbus_do_remove(client); - kfree(data); return 0; } |