From 8b313ca7f1b98263ce22519b25a9c2a362eeb898 Mon Sep 17 00:00:00 2001 From: Guenter Roeck Date: Wed, 22 Feb 2012 08:56:43 -0800 Subject: hwmon: (pmbus) Convert pmbus drivers to use devm_kzalloc Marginally less code and eliminate the possibility of memory leaks. Signed-off-by: Guenter Roeck --- drivers/hwmon/pmbus/adm1275.c | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) (limited to 'drivers/hwmon/pmbus/adm1275.c') 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; } -- cgit v1.2.3-55-g7522