summaryrefslogtreecommitdiffstats
path: root/drivers/hwmon/lm85.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/hwmon/lm85.c')
-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