Skip to content

Commit

Permalink
hwmon: (lm85) Convert to use devm_ functions
Browse files Browse the repository at this point in the history
Convert to use devm_ functions to reduce code size and simplify the code.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Acked-by: Jean Delvare <khali@linux-fr.org>
  • Loading branch information
Guenter Roeck committed Jul 22, 2012
1 parent c38b282 commit 747e5d6
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions drivers/hwmon/lm85.c
Original file line number Diff line number Diff line change
Expand Up @@ -1387,7 +1387,7 @@ static int lm85_probe(struct i2c_client *client,
struct lm85_data *data;
int err;

data = kzalloc(sizeof(struct lm85_data), GFP_KERNEL);
data = devm_kzalloc(&client->dev, sizeof(struct lm85_data), GFP_KERNEL);
if (!data)
return -ENOMEM;

Expand Down Expand Up @@ -1419,7 +1419,7 @@ static int lm85_probe(struct i2c_client *client,
/* Register sysfs hooks */
err = sysfs_create_group(&client->dev.kobj, &lm85_group);
if (err)
goto err_kfree;
return err;

/* minctl and temp_off exist on all chips except emc6d103s */
if (data->type != emc6d103s) {
Expand Down Expand Up @@ -1466,8 +1466,6 @@ static int lm85_probe(struct i2c_client *client,
/* Error out and cleanup code */
err_remove_files:
lm85_remove_files(client, data);
err_kfree:
kfree(data);
return err;
}

Expand All @@ -1476,7 +1474,6 @@ static int lm85_remove(struct i2c_client *client)
struct lm85_data *data = i2c_get_clientdata(client);
hwmon_device_unregister(data->hwmon_dev);
lm85_remove_files(client, data);
kfree(data);
return 0;
}

Expand Down

0 comments on commit 747e5d6

Please sign in to comment.