hwmon: (tmp102) Improve error handling

Use devm_add_action_or_reset() instead of devm_add_action(), and
check its return code.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
This commit is contained in:
Guenter Roeck 2016-07-25 14:57:47 -07:00
parent 90e2b545ce
commit 1aa4f0289f
1 changed files with 3 additions and 1 deletions

View File

@ -227,7 +227,9 @@ static int tmp102_probe(struct i2c_client *client,
tmp102->config_orig = regval;
devm_add_action(dev, tmp102_restore_config, tmp102);
err = devm_add_action_or_reset(dev, tmp102_restore_config, tmp102);
if (err)
return err;
regval &= ~TMP102_CONFIG_CLEAR;
regval |= TMP102_CONFIG_SET;