regulator: Fixes for v6.0

One core fix here improving the error handling on enable failure, plus
 smaller fixes for the pfuze100 drive and the SPMI DT bindings.
 -----BEGIN PGP SIGNATURE-----
 
 iQEzBAABCgAdFiEEreZoqmdXGLWf4p/qJNaLcl1Uh9AFAmMZ3IUACgkQJNaLcl1U
 h9CwbQf6AzcfEH0QTrQrkJV5m0lWfpxSdmxWg2NSmKDsCUTEg4KKV86+iGbOax1y
 StciVjWKBQ7nTwX7d2tWYL67ogziN4ePFdroKzIHMkj50+qWfy1KsopsWgm6joYj
 YCfWro3f2LHD7CC70qsd1yoVV4mO+yzdwkc0qtxQe4l9rvsdfA8VH80MjGyWaxUO
 dz8BjLAk3ivCsCTCGFkL3k51HLm7ORbX8ruCqFnW3a6neblliIP/z+MkNhLgZC7q
 +P3GGbBYYs1d9Ay5IIM04FszhJEOfG7RSeqMosi6gCl2r8Vw3UNJ7rUyH/cGTwyV
 eZFTgd89kiVg1I97FxbI4Wb1SjPg0A==
 =97j3
 -----END PGP SIGNATURE-----

Merge tag 'regulator-fix-v6.0-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator

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
This commit is contained in:
Linus Torvalds 2022-09-08 12:56:20 -04:00
commit c5e68c4fa5
3 changed files with 9 additions and 5 deletions

View File

@ -35,6 +35,7 @@ patternProperties:
description: List of regulators and its properties
type: object
$ref: regulator.yaml#
unevaluatedProperties: false
properties:
qcom,ocp-max-retries:
@ -100,8 +101,6 @@ patternProperties:
SAW controlled gang leader. Will be configured as SAW regulator.
type: boolean
unevaluatedProperties: false
required:
- compatible

View File

@ -2733,13 +2733,18 @@ static int _regulator_do_enable(struct regulator_dev *rdev)
*/
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;
}

View File

@ -766,7 +766,7 @@ static int pfuze100_regulator_probe(struct i2c_client *client,
((pfuze_chip->chip_id == PFUZE3000) ? "3000" : "3001"))));
memcpy(pfuze_chip->regulator_descs, pfuze_chip->pfuze_regulators,
sizeof(pfuze_chip->regulator_descs));
regulator_num * sizeof(struct pfuze_regulator));
ret = pfuze_parse_regulators_dt(pfuze_chip);
if (ret)