Merge tag 'regulator-fix-v6.0-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git...
authorLinus Torvalds <torvalds@linux-foundation.org>
Thu, 8 Sep 2022 16:56:20 +0000 (12:56 -0400)
committerLinus Torvalds <torvalds@linux-foundation.org>
Thu, 8 Sep 2022 16:56:20 +0000 (12:56 -0400)
Pull regulator fixes from Mark Brown:
 "One core fix here improving the error handling on enable failure, plus
  smaller fixes for the pfuze100 drive and the SPMI DT bindings"

* tag 'regulator-fix-v6.0-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator:
  regulator: Fix qcom,spmi-regulator schema
  regulator: pfuze100: Fix the global-out-of-bounds access in pfuze100_regulator_probe()
  regulator: core: Clean up on enable failure

1  2 
drivers/regulator/core.c

diff --combined drivers/regulator/core.c
@@@ -2733,13 -2733,18 +2733,18 @@@ static int _regulator_do_enable(struct 
   */
  static int _regulator_handle_consumer_enable(struct regulator *regulator)
  {
+       int ret;
        struct regulator_dev *rdev = regulator->rdev;
  
        lockdep_assert_held_once(&rdev->mutex.base);
  
        regulator->enable_count++;
-       if (regulator->uA_load && regulator->enable_count == 1)
-               return drms_uA_update(rdev);
+       if (regulator->uA_load && regulator->enable_count == 1) {
+               ret = drms_uA_update(rdev);
+               if (ret)
+                       regulator->enable_count--;
+               return ret;
+       }
  
        return 0;
  }
@@@ -4784,10 -4789,10 +4789,10 @@@ int regulator_bulk_get(struct device *d
                consumers[i].consumer = regulator_get(dev,
                                                      consumers[i].supply);
                if (IS_ERR(consumers[i].consumer)) {
 -                      consumers[i].consumer = NULL;
                        ret = dev_err_probe(dev, PTR_ERR(consumers[i].consumer),
                                            "Failed to get supply '%s'",
                                            consumers[i].supply);
 +                      consumers[i].consumer = NULL;
                        goto err;
                }