Skip to content

Commit

Permalink
hwmon: (lm75) 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 value.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
  • Loading branch information
Guenter Roeck committed Jul 31, 2016
1 parent c5fcf01 commit 90e2b54
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions drivers/hwmon/lm75.c
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ lm75_probe(struct i2c_client *client, const struct i2c_device_id *id)
struct device *dev = &client->dev;
struct device *hwmon_dev;
struct lm75_data *data;
int status;
int status, err;
u8 set_mask, clr_mask;
int new;
enum lm75_type kind = id->driver_data;
Expand Down Expand Up @@ -331,7 +331,9 @@ lm75_probe(struct i2c_client *client, const struct i2c_device_id *id)
if (status != new)
i2c_smbus_write_byte_data(client, LM75_REG_CONF, new);

devm_add_action(dev, lm75_remove, data);
err = devm_add_action_or_reset(dev, lm75_remove, data);
if (err)
return err;

dev_dbg(dev, "Config %02x\n", new);

Expand Down

0 comments on commit 90e2b54

Please sign in to comment.