Merge tag 'hwmon-for-linus-v4.8-2' of git://git.kernel.org/pub/scm/linux/kernel/git...
authorLinus Torvalds <torvalds@linux-foundation.org>
Mon, 1 Aug 2016 20:49:13 +0000 (16:49 -0400)
committerLinus Torvalds <torvalds@linux-foundation.org>
Mon, 1 Aug 2016 20:49:13 +0000 (16:49 -0400)
Pull more hwmon updates from Guenter Roeck:

 - Improved error handling in tmp102, lm75, and lm90 drivers

 - Bug fixes in sht3x, ftsteutates, iio_hwmon, and adt7411 drivers

* tag 'hwmon-for-linus-v4.8-2' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging:
  hwmon: (adt7411) set sane values for CFG1 and CFG3
  hwmon: (iio_hwmon) fix memory leak in name attribute
  hwmon: (ftsteutates) Fix potential memory access error
  hwmon: (tmp102) Improve error handling
  hwmon: (lm75) Improve error handling
  hwmon: (lm90) Improve error handling
  hwmon: (lm90) Add missing assignment
  hwmon: (sht3x) set initial jiffies to last_update

1  2 
drivers/hwmon/lm90.c

diff --combined drivers/hwmon/lm90.c
@@@ -529,7 -529,7 +529,7 @@@ static int lm90_update_limits(struct de
                return val;
        data->temp_hyst = val;
  
-       lm90_read_reg(client, LM90_REG_R_REMOTE_LOWH);
+       val = lm90_read_reg(client, LM90_REG_R_REMOTE_LOWH);
        if (val < 0)
                return val;
        data->temp11[REMOTE_LOW] = val << 8;
@@@ -1551,9 -1551,7 +1551,7 @@@ static int lm90_init_client(struct i2c_
        if (config != data->config_orig) /* Only write if changed */
                i2c_smbus_write_byte_data(client, LM90_REG_W_CONFIG1, config);
  
-       devm_add_action(&client->dev, lm90_restore_conf, data);
-       return 0;
+       return devm_add_action_or_reset(&client->dev, lm90_restore_conf, data);
  }
  
  static bool lm90_is_tripped(struct i2c_client *client, u16 *status)
@@@ -1640,7 -1638,9 +1638,9 @@@ static int lm90_probe(struct i2c_clien
                return err;
        }
  
-       devm_add_action(dev, lm90_regulator_disable, regulator);
+       err = devm_add_action_or_reset(dev, lm90_regulator_disable, regulator);
+       if (err)
+               return err;
  
        data = devm_kzalloc(dev, sizeof(struct lm90_data), GFP_KERNEL);
        if (!data)
                err = device_create_file(dev, &dev_attr_pec);
                if (err)
                        return err;
-               devm_add_action(dev, lm90_remove_pec, dev);
+               err = devm_add_action_or_reset(dev, lm90_remove_pec, dev);
+               if (err)
+                       return err;
        }
  
        hwmon_dev = devm_hwmon_device_register_with_groups(dev, client->name,
        return 0;
  }
  
 -static void lm90_alert(struct i2c_client *client, unsigned int flag)
 +static void lm90_alert(struct i2c_client *client, enum i2c_alert_protocol type,
 +                     unsigned int flag)
  {
        u16 alarms;
  
 +      if (type != I2C_PROTOCOL_SMBUS_ALERT)
 +              return;
 +
        if (lm90_is_tripped(client, &alarms)) {
                /*
                 * Disable ALERT# output, because these chips don't implement