diff options
author | Guenter Roeck <linux@roeck-us.net> | 2012-06-02 18:58:13 +0200 |
---|---|---|
committer | Guenter Roeck <linux@roeck-us.net> | 2012-07-22 06:48:37 +0200 |
commit | 94cd52027aa52780e56e11fd08703d955f0ff91e (patch) | |
tree | cd433c21aa1d5de66e82a56d659ffa100d388b09 /drivers/hwmon/max6650.c | |
parent | hwmon: (wm831x-hwmon) Convert to use devm_ functions (diff) | |
download | linux-94cd52027aa52780e56e11fd08703d955f0ff91e.tar.xz linux-94cd52027aa52780e56e11fd08703d955f0ff91e.zip |
hwmon: (max6650) Convert to use devm_ functions
Convert to use devm_ functions to reduce code size and simplify the code.
Cc: Hans J. Koch <hjk@hansjkoch.de>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Acked-by: Hans J. Koch <hjk@hansjkoch.de>
Diffstat (limited to 'drivers/hwmon/max6650.c')
-rw-r--r-- | drivers/hwmon/max6650.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/drivers/hwmon/max6650.c b/drivers/hwmon/max6650.c index 33a8a7f15e18..f739f83bafb9 100644 --- a/drivers/hwmon/max6650.c +++ b/drivers/hwmon/max6650.c @@ -545,7 +545,8 @@ static int max6650_probe(struct i2c_client *client, struct max6650_data *data; int err; - data = kzalloc(sizeof(struct max6650_data), GFP_KERNEL); + data = devm_kzalloc(&client->dev, sizeof(struct max6650_data), + GFP_KERNEL); if (!data) { dev_err(&client->dev, "out of memory.\n"); return -ENOMEM; @@ -560,11 +561,11 @@ static int max6650_probe(struct i2c_client *client, */ err = max6650_init_client(client); if (err) - goto err_free; + return err; err = sysfs_create_group(&client->dev.kobj, &max6650_attr_grp); if (err) - goto err_free; + return err; /* 3 additional fan inputs for the MAX6651 */ if (data->nr_fans == 4) { err = sysfs_create_group(&client->dev.kobj, &max6651_attr_grp); @@ -582,8 +583,6 @@ static int max6650_probe(struct i2c_client *client, sysfs_remove_group(&client->dev.kobj, &max6651_attr_grp); err_remove: sysfs_remove_group(&client->dev.kobj, &max6650_attr_grp); -err_free: - kfree(data); return err; } @@ -595,7 +594,6 @@ static int max6650_remove(struct i2c_client *client) if (data->nr_fans == 4) sysfs_remove_group(&client->dev.kobj, &max6651_attr_grp); sysfs_remove_group(&client->dev.kobj, &max6650_attr_grp); - kfree(data); return 0; } |