summaryrefslogtreecommitdiffstats
path: root/drivers/hwmon/adt7411.c
diff options
context:
space:
mode:
authorGuenter Roeck <linux@roeck-us.net>2012-06-02 09:58:01 -0700
committerGuenter Roeck <linux@roeck-us.net>2012-09-23 21:08:30 -0700
commit65ec17b0d5a5351846e3503d5599e1630e57ffc4 (patch)
tree55035ab41347412249fc9d7af9b809957c25a91b /drivers/hwmon/adt7411.c
parent33fd2b84c94f978e661c20267548b736d84f4645 (diff)
downloadblackbird-op-linux-65ec17b0d5a5351846e3503d5599e1630e57ffc4.tar.gz
blackbird-op-linux-65ec17b0d5a5351846e3503d5599e1630e57ffc4.zip
hwmon: (adt7411) Convert to use devm_ functions
Convert to use devm_ functions to reduce code size and simplify the code. Cc: Wolfram Sang <w.sang@pengutronix.de> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Diffstat (limited to 'drivers/hwmon/adt7411.c')
-rw-r--r--drivers/hwmon/adt7411.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/drivers/hwmon/adt7411.c b/drivers/hwmon/adt7411.c
index 71bacc56e138..fe72c69a2d68 100644
--- a/drivers/hwmon/adt7411.c
+++ b/drivers/hwmon/adt7411.c
@@ -283,7 +283,7 @@ static int __devinit adt7411_probe(struct i2c_client *client,
struct adt7411_data *data;
int ret;
- data = kzalloc(sizeof(*data), GFP_KERNEL);
+ data = devm_kzalloc(&client->dev, sizeof(*data), GFP_KERNEL);
if (!data)
return -ENOMEM;
@@ -294,14 +294,14 @@ static int __devinit adt7411_probe(struct i2c_client *client,
ret = adt7411_modify_bit(client, ADT7411_REG_CFG1,
ADT7411_CFG1_START_MONITOR, 1);
if (ret < 0)
- goto exit_free;
+ return ret;
/* force update on first occasion */
data->next_update = jiffies;
ret = sysfs_create_group(&client->dev.kobj, &adt7411_attr_grp);
if (ret)
- goto exit_free;
+ return ret;
data->hwmon_dev = hwmon_device_register(&client->dev);
if (IS_ERR(data->hwmon_dev)) {
@@ -315,8 +315,6 @@ static int __devinit adt7411_probe(struct i2c_client *client,
exit_remove:
sysfs_remove_group(&client->dev.kobj, &adt7411_attr_grp);
- exit_free:
- kfree(data);
return ret;
}
@@ -326,7 +324,6 @@ static int __devexit adt7411_remove(struct i2c_client *client)
hwmon_device_unregister(data->hwmon_dev);
sysfs_remove_group(&client->dev.kobj, &adt7411_attr_grp);
- kfree(data);
return 0;
}
OpenPOWER on IntegriCloud