diff options
author | Guenter Roeck <linux@roeck-us.net> | 2016-07-25 17:56:00 -0400 |
---|---|---|
committer | Guenter Roeck <linux@roeck-us.net> | 2016-07-31 18:02:51 -0400 |
commit | 90e2b545ce78516e727ba641e9f2b0703a17da1a (patch) | |
tree | 200bdfd4695481acc2f1de856ab126571f3a1f88 /drivers/hwmon/lm75.c | |
parent | c5fcf01bcfceb245da575cc5bfa4391642649f2d (diff) |
hwmon: (lm75) Improve error handling
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>
Diffstat (limited to 'drivers/hwmon/lm75.c')
-rw-r--r-- | drivers/hwmon/lm75.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/hwmon/lm75.c b/drivers/hwmon/lm75.c index 547a9c87c68c..92f9d4bbf597 100644 --- a/drivers/hwmon/lm75.c +++ b/drivers/hwmon/lm75.c | |||
@@ -220,7 +220,7 @@ lm75_probe(struct i2c_client *client, const struct i2c_device_id *id) | |||
220 | struct device *dev = &client->dev; | 220 | struct device *dev = &client->dev; |
221 | struct device *hwmon_dev; | 221 | struct device *hwmon_dev; |
222 | struct lm75_data *data; | 222 | struct lm75_data *data; |
223 | int status; | 223 | int status, err; |
224 | u8 set_mask, clr_mask; | 224 | u8 set_mask, clr_mask; |
225 | int new; | 225 | int new; |
226 | enum lm75_type kind = id->driver_data; | 226 | enum lm75_type kind = id->driver_data; |
@@ -331,7 +331,9 @@ lm75_probe(struct i2c_client *client, const struct i2c_device_id *id) | |||
331 | if (status != new) | 331 | if (status != new) |
332 | i2c_smbus_write_byte_data(client, LM75_REG_CONF, new); | 332 | i2c_smbus_write_byte_data(client, LM75_REG_CONF, new); |
333 | 333 | ||
334 | devm_add_action(dev, lm75_remove, data); | 334 | err = devm_add_action_or_reset(dev, lm75_remove, data); |
335 | if (err) | ||
336 | return err; | ||
335 | 337 | ||
336 | dev_dbg(dev, "Config %02x\n", new); | 338 | dev_dbg(dev, "Config %02x\n", new); |
337 | 339 | ||