aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hwmon/emc2103.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/hwmon/emc2103.c')
-rw-r--r--drivers/hwmon/emc2103.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/drivers/hwmon/emc2103.c b/drivers/hwmon/emc2103.c
index 7bb8e888692c..77f434c58236 100644
--- a/drivers/hwmon/emc2103.c
+++ b/drivers/hwmon/emc2103.c
@@ -590,7 +590,8 @@ emc2103_probe(struct i2c_client *client, const struct i2c_device_id *id)
590 if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA)) 590 if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA))
591 return -EIO; 591 return -EIO;
592 592
593 data = kzalloc(sizeof(struct emc2103_data), GFP_KERNEL); 593 data = devm_kzalloc(&client->dev, sizeof(struct emc2103_data),
594 GFP_KERNEL);
594 if (!data) 595 if (!data)
595 return -ENOMEM; 596 return -ENOMEM;
596 597
@@ -608,7 +609,7 @@ emc2103_probe(struct i2c_client *client, const struct i2c_device_id *id)
608 if (status < 0) { 609 if (status < 0) {
609 dev_dbg(&client->dev, "reg 0x%02x, err %d\n", REG_CONF1, 610 dev_dbg(&client->dev, "reg 0x%02x, err %d\n", REG_CONF1,
610 status); 611 status);
611 goto exit_free; 612 return status;
612 } 613 }
613 614
614 /* detect current state of hardware */ 615 /* detect current state of hardware */
@@ -631,7 +632,7 @@ emc2103_probe(struct i2c_client *client, const struct i2c_device_id *id)
631 /* Register sysfs hooks */ 632 /* Register sysfs hooks */
632 status = sysfs_create_group(&client->dev.kobj, &emc2103_group); 633 status = sysfs_create_group(&client->dev.kobj, &emc2103_group);
633 if (status) 634 if (status)
634 goto exit_free; 635 return status;
635 636
636 if (data->temp_count >= 3) { 637 if (data->temp_count >= 3) {
637 status = sysfs_create_group(&client->dev.kobj, 638 status = sysfs_create_group(&client->dev.kobj,
@@ -666,8 +667,6 @@ exit_remove_temp3:
666 sysfs_remove_group(&client->dev.kobj, &emc2103_temp3_group); 667 sysfs_remove_group(&client->dev.kobj, &emc2103_temp3_group);
667exit_remove: 668exit_remove:
668 sysfs_remove_group(&client->dev.kobj, &emc2103_group); 669 sysfs_remove_group(&client->dev.kobj, &emc2103_group);
669exit_free:
670 kfree(data);
671 return status; 670 return status;
672} 671}
673 672
@@ -685,7 +684,6 @@ static int emc2103_remove(struct i2c_client *client)
685 684
686 sysfs_remove_group(&client->dev.kobj, &emc2103_group); 685 sysfs_remove_group(&client->dev.kobj, &emc2103_group);
687 686
688 kfree(data);
689 return 0; 687 return 0;
690} 688}
691 689