diff options
author | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2012-09-05 07:57:19 +0200 |
---|---|---|
committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2012-09-05 07:57:19 +0200 |
commit | e6c340171f0daaccc95b90abbeed2b837157ee11 (patch) | |
tree | 843d4035be59bd791321910e52157ce527b3b4b3 /drivers/hwmon/adm1021.c | |
parent | Input: tegra - move platform data header (diff) | |
parent | Linux 3.6-rc4 (diff) | |
download | linux-e6c340171f0daaccc95b90abbeed2b837157ee11.tar.xz linux-e6c340171f0daaccc95b90abbeed2b837157ee11.zip |
Merge tag 'v3.6-rc4' into next
Linux 3.6-rc4
# gpg: Signature made Sat 01 Sep 2012 10:40:33 AM PDT using RSA key ID 00411886
# gpg: Good signature from "Linus Torvalds <torvalds@linux-foundation.org>"
Diffstat (limited to 'drivers/hwmon/adm1021.c')
-rw-r--r-- | drivers/hwmon/adm1021.c | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/drivers/hwmon/adm1021.c b/drivers/hwmon/adm1021.c index 4394e7e99c46..fd1d1b15854e 100644 --- a/drivers/hwmon/adm1021.c +++ b/drivers/hwmon/adm1021.c @@ -366,11 +366,11 @@ static int adm1021_probe(struct i2c_client *client, struct adm1021_data *data; int err; - data = kzalloc(sizeof(struct adm1021_data), GFP_KERNEL); + data = devm_kzalloc(&client->dev, sizeof(struct adm1021_data), + GFP_KERNEL); if (!data) { - pr_debug("adm1021: detect failed, kzalloc failed!\n"); - err = -ENOMEM; - goto error0; + pr_debug("adm1021: detect failed, devm_kzalloc failed!\n"); + return -ENOMEM; } i2c_set_clientdata(client, data); @@ -384,21 +384,18 @@ static int adm1021_probe(struct i2c_client *client, /* Register sysfs hooks */ err = sysfs_create_group(&client->dev.kobj, &adm1021_group); if (err) - goto error1; + return err; data->hwmon_dev = hwmon_device_register(&client->dev); if (IS_ERR(data->hwmon_dev)) { err = PTR_ERR(data->hwmon_dev); - goto error3; + goto error; } return 0; -error3: +error: sysfs_remove_group(&client->dev.kobj, &adm1021_group); -error1: - kfree(data); -error0: return err; } @@ -418,7 +415,6 @@ static int adm1021_remove(struct i2c_client *client) hwmon_device_unregister(data->hwmon_dev); sysfs_remove_group(&client->dev.kobj, &adm1021_group); - kfree(data); return 0; } |