summaryrefslogtreecommitdiff
path: root/drivers/regulator/core.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2025-12-11 09:54:59 +0900
committerLinus Torvalds <torvalds@linux-foundation.org>2025-12-11 09:54:59 +0900
commit31ca9ff64ae91283436739ce3277facb89c7901d (patch)
treeeff00feb17f94befcee72963f5995d4bbb44f406 /drivers/regulator/core.c
parent1de741159bbb187c8018c4c779acde4ea0188478 (diff)
parent99f0c3a654c4a762aca4fadc8d9f8636b36d570a (diff)
Merge tag 'regulator-fix-v6.19-merge-window' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator
Pull regulator fixes from Mark Brown: "A few fixes that came in during the merge window, nothing too exciting - the one core fix improves error propagation from gpiolib which hopefully shouldn't actually happen but is safer" * tag 'regulator-fix-v6.19-merge-window' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator: regulator: spacemit: Align input supply name with the DT binding regulator: fixed: Rely on the core freeing the enable GPIO regulator: check the return value of gpiod_set_value_cansleep()
Diffstat (limited to 'drivers/regulator/core.c')
-rw-r--r--drivers/regulator/core.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index f4987f54e01b..4b6182cde859 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -2823,14 +2823,18 @@ static void regulator_ena_gpio_free(struct regulator_dev *rdev)
static int regulator_ena_gpio_ctrl(struct regulator_dev *rdev, bool enable)
{
struct regulator_enable_gpio *pin = rdev->ena_pin;
+ int ret;
if (!pin)
return -EINVAL;
if (enable) {
/* Enable GPIO at initial use */
- if (pin->enable_count == 0)
- gpiod_set_value_cansleep(pin->gpiod, 1);
+ if (pin->enable_count == 0) {
+ ret = gpiod_set_value_cansleep(pin->gpiod, 1);
+ if (ret)
+ return ret;
+ }
pin->enable_count++;
} else {
@@ -2841,7 +2845,10 @@ static int regulator_ena_gpio_ctrl(struct regulator_dev *rdev, bool enable)
/* Disable GPIO if not used */
if (pin->enable_count <= 1) {
- gpiod_set_value_cansleep(pin->gpiod, 0);
+ ret = gpiod_set_value_cansleep(pin->gpiod, 0);
+ if (ret)
+ return ret;
+
pin->enable_count = 0;
}
}