aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorGuenter Roeck <linux@roeck-us.net>2012-06-02 12:58:10 -0400
committerGuenter Roeck <linux@roeck-us.net>2012-07-22 00:48:40 -0400
commit747e5d62ac85b9706739d2e21b1722f68d797da0 (patch)
tree935eba9653b27e98b9a1ce9620c3aad95974c348 /drivers
parentc38b2820cb4014b86b0bf45f334d3436c03b14be (diff)
hwmon: (lm85) 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> Acked-by: Jean Delvare <khali@linux-fr.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/hwmon/lm85.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/drivers/hwmon/lm85.c b/drivers/hwmon/lm85.c
index 864c7d999e0c..9f2dd77e1e0e 100644
--- a/drivers/hwmon/lm85.c
+++ b/drivers/hwmon/lm85.c
@@ -1387,7 +1387,7 @@ static int lm85_probe(struct i2c_client *client,
1387 struct lm85_data *data; 1387 struct lm85_data *data;
1388 int err; 1388 int err;
1389 1389
1390 data = kzalloc(sizeof(struct lm85_data), GFP_KERNEL); 1390 data = devm_kzalloc(&client->dev, sizeof(struct lm85_data), GFP_KERNEL);
1391 if (!data) 1391 if (!data)
1392 return -ENOMEM; 1392 return -ENOMEM;
1393 1393
@@ -1419,7 +1419,7 @@ static int lm85_probe(struct i2c_client *client,
1419 /* Register sysfs hooks */ 1419 /* Register sysfs hooks */
1420 err = sysfs_create_group(&client->dev.kobj, &lm85_group); 1420 err = sysfs_create_group(&client->dev.kobj, &lm85_group);
1421 if (err) 1421 if (err)
1422 goto err_kfree; 1422 return err;
1423 1423
1424 /* minctl and temp_off exist on all chips except emc6d103s */ 1424 /* minctl and temp_off exist on all chips except emc6d103s */
1425 if (data->type != emc6d103s) { 1425 if (data->type != emc6d103s) {
@@ -1466,8 +1466,6 @@ static int lm85_probe(struct i2c_client *client,
1466 /* Error out and cleanup code */ 1466 /* Error out and cleanup code */
1467 err_remove_files: 1467 err_remove_files:
1468 lm85_remove_files(client, data); 1468 lm85_remove_files(client, data);
1469 err_kfree:
1470 kfree(data);
1471 return err; 1469 return err;
1472} 1470}
1473 1471
@@ -1476,7 +1474,6 @@ static int lm85_remove(struct i2c_client *client)
1476 struct lm85_data *data = i2c_get_clientdata(client); 1474 struct lm85_data *data = i2c_get_clientdata(client);
1477 hwmon_device_unregister(data->hwmon_dev); 1475 hwmon_device_unregister(data->hwmon_dev);
1478 lm85_remove_files(client, data); 1476 lm85_remove_files(client, data);
1479 kfree(data);
1480 return 0; 1477 return 0;
1481} 1478}
1482 1479