Skip to content

Commit

Permalink
hwmon: (tmp102) Improve error handling
Browse files Browse the repository at this point in the history
Use devm_add_action_or_reset() instead of devm_add_action(), and
check its return code.

Signed-off-by: Guenter Roeck <[email protected]>
  • Loading branch information
groeck committed Jul 31, 2016
1 parent 90e2b54 commit 1aa4f02
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion drivers/hwmon/tmp102.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 1aa4f02

Please sign in to comment.