diff options
author | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2012-09-04 22:57:19 -0700 |
---|---|---|
committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2012-09-04 22:57:19 -0700 |
commit | e6c340171f0daaccc95b90abbeed2b837157ee11 (patch) | |
tree | 843d4035be59bd791321910e52157ce527b3b4b3 /drivers/hwmon/tmp102.c | |
parent | a85442ade272121927a56e02f7dfde1127482df2 (diff) | |
parent | 4cbe5a555fa58a79b6ecbb6c531b8bab0650778d (diff) |
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/tmp102.c')
-rw-r--r-- | drivers/hwmon/tmp102.c | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/drivers/hwmon/tmp102.c b/drivers/hwmon/tmp102.c index 0d466b9d890..4e1ff82c63e 100644 --- a/drivers/hwmon/tmp102.c +++ b/drivers/hwmon/tmp102.c @@ -159,17 +159,16 @@ static int __devinit tmp102_probe(struct i2c_client *client, return -ENODEV; } - tmp102 = kzalloc(sizeof(*tmp102), GFP_KERNEL); - if (!tmp102) { - dev_dbg(&client->dev, "kzalloc failed\n"); + tmp102 = devm_kzalloc(&client->dev, sizeof(*tmp102), GFP_KERNEL); + if (!tmp102) return -ENOMEM; - } + i2c_set_clientdata(client, tmp102); status = i2c_smbus_read_word_swapped(client, TMP102_CONF_REG); if (status < 0) { dev_err(&client->dev, "error reading config register\n"); - goto fail_free; + return status; } tmp102->config_orig = status; status = i2c_smbus_write_word_swapped(client, TMP102_CONF_REG, @@ -213,9 +212,6 @@ fail_remove_sysfs: fail_restore_config: i2c_smbus_write_word_swapped(client, TMP102_CONF_REG, tmp102->config_orig); -fail_free: - kfree(tmp102); - return status; } @@ -236,8 +232,6 @@ static int __devexit tmp102_remove(struct i2c_client *client) config | TMP102_CONF_SD); } - kfree(tmp102); - return 0; } |