diff options
author | Guenter Roeck <linux@roeck-us.net> | 2012-06-02 09:58:12 -0700 |
---|---|---|
committer | Guenter Roeck <linux@roeck-us.net> | 2012-09-23 21:08:32 -0700 |
commit | 7008b9704ada3d7483358da7a3c7c640e1e0be17 (patch) | |
tree | 8d96bfe4002d569cd2029c9c081932b55ef25cd6 /drivers/hwmon | |
parent | a8dd946c420781fd7a70fec8b75e0daf67c4a681 (diff) |
hwmon: (max1668) Convert to use devm_ functions
Convert to use devm_ functions to reduce code size and simplify the code.
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Diffstat (limited to 'drivers/hwmon')
-rw-r--r-- | drivers/hwmon/max1668.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/drivers/hwmon/max1668.c b/drivers/hwmon/max1668.c index 335b183d7c02..666d9f6263eb 100644 --- a/drivers/hwmon/max1668.c +++ b/drivers/hwmon/max1668.c @@ -411,7 +411,8 @@ static int max1668_probe(struct i2c_client *client, if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) return -ENODEV; - data = kzalloc(sizeof(struct max1668_data), GFP_KERNEL); + data = devm_kzalloc(&client->dev, sizeof(struct max1668_data), + GFP_KERNEL); if (!data) return -ENOMEM; @@ -422,7 +423,7 @@ static int max1668_probe(struct i2c_client *client, /* Register sysfs hooks */ err = sysfs_create_group(&client->dev.kobj, &max1668_group_common); if (err) - goto error_free; + return err; if (data->type == max1668 || data->type == max1989) { err = sysfs_create_group(&client->dev.kobj, @@ -444,8 +445,6 @@ error_sysrem1: sysfs_remove_group(&client->dev.kobj, &max1668_group_unique); error_sysrem0: sysfs_remove_group(&client->dev.kobj, &max1668_group_common); -error_free: - kfree(data); return err; } @@ -459,7 +458,6 @@ static int max1668_remove(struct i2c_client *client) sysfs_remove_group(&client->dev.kobj, &max1668_group_common); - kfree(data); return 0; } |