diff options
author | Guenter Roeck <linux@roeck-us.net> | 2012-02-22 08:56:43 -0800 |
---|---|---|
committer | Guenter Roeck <guenter.roeck@ericsson.com> | 2012-03-18 18:27:45 -0700 |
commit | 8b313ca7f1b98263ce22519b25a9c2a362eeb898 (patch) | |
tree | 36c4e576662996be3fcac1f34d339dcd53e569e3 /drivers/hwmon/pmbus/pmbus.c | |
parent | 07404aab52f5106ec436692474cf8f40978f5dac (diff) |
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/pmbus.c')
-rw-r--r-- | drivers/hwmon/pmbus/pmbus.c | 17 |
1 files changed, 3 insertions, 14 deletions
diff --git a/drivers/hwmon/pmbus/pmbus.c b/drivers/hwmon/pmbus/pmbus.c index da5fe361a94..b94bec23d95 100644 --- a/drivers/hwmon/pmbus/pmbus.c +++ b/drivers/hwmon/pmbus/pmbus.c @@ -166,32 +166,21 @@ static int pmbus_probe(struct i2c_client *client, const struct i2c_device_id *id) { struct pmbus_driver_info *info; - int ret; - info = kzalloc(sizeof(struct pmbus_driver_info), GFP_KERNEL); + info = devm_kzalloc(&client->dev, sizeof(struct pmbus_driver_info), + GFP_KERNEL); if (!info) return -ENOMEM; info->pages = id->driver_data; info->identify = pmbus_identify; - ret = pmbus_do_probe(client, id, info); - if (ret < 0) - goto out; - return 0; - -out: - kfree(info); - return ret; + return pmbus_do_probe(client, id, info); } static int pmbus_remove(struct i2c_client *client) { - const struct pmbus_driver_info *info; - - info = pmbus_get_driver_info(client); pmbus_do_remove(client); - kfree(info); return 0; } |