From: Lee Jones <lee@kernel.org>
To: lee@kernel.org, Liam Girdwood <lgirdwood@gmail.com>,
Mark Brown <broonie@kernel.org>,
Chris Morgan <macromorgan@hotmail.com>,
linux-kernel@vger.kernel.org
Cc: stable@vger.kernel.org
Subject: [PATCH 07/10] regulator: bq257xx: Propagate GPIO error in bq257xx_reg_dt_parse_gpio()
Date: Wed, 4 Nov 2026 18:20:57 +0000 [thread overview]
Message-ID: <20261104182148.1176116-8-lee@kernel.org> (raw)
In-Reply-To: <20261104182148.1176116-1-lee@kernel.org>
When devm_fwnode_gpiod_get_index() fails with an error other than
-ENOENT (such as -EPROBE_DEFER), bq257xx_reg_dt_parse_gpio() logs the
error and returns void, leaving the error pointer stored in
pdata->otg_en_gpio. bq257xx_regulator_probe() then registers the
regulator and bq25703_vbus_enable() / bq25703_vbus_disable() pass the
ERR_PTR to gpiod_set_value_cansleep().
Return the error code from bq257xx_reg_dt_parse_gpio() via
dev_err_probe() and propagate it from bq257xx_regulator_probe().
Fixes: 981dd162b635 ("regulator: bq257xx: Add bq257xx boost regulator driver")
Closes: https://sashiko.dev/#/bug/linux-0d1fc150-1400-4ba5-ad27-3d7376fb2d7d
Cc: stable@vger.kernel.org
Signed-off-by: Lee Jones <lee@kernel.org>
---
drivers/regulator/bq257xx-regulator.c | 20 ++++++++++++--------
1 file changed, 12 insertions(+), 8 deletions(-)
diff --git a/drivers/regulator/bq257xx-regulator.c b/drivers/regulator/bq257xx-regulator.c
index 577b277efd7f..0db99a74e9e8 100644
--- a/drivers/regulator/bq257xx-regulator.c
+++ b/drivers/regulator/bq257xx-regulator.c
@@ -103,7 +103,7 @@ static const struct regulator_desc bq25703_vbus_desc = {
};
/* Get optional GPIO for OTG regulator enable. */
-static void bq257xx_reg_dt_parse_gpio(struct platform_device *pdev)
+static int bq257xx_reg_dt_parse_gpio(struct platform_device *pdev)
{
struct device_node *child, *subchild;
struct bq257xx_reg_data *pdata = platform_get_drvdata(pdev);
@@ -111,12 +111,12 @@ static void bq257xx_reg_dt_parse_gpio(struct platform_device *pdev)
child = of_get_child_by_name(pdev->dev.of_node,
pdata->desc.regulators_node);
if (!child)
- return;
+ return 0;
subchild = of_get_child_by_name(child, pdata->desc.of_match);
of_node_put(child);
if (!subchild)
- return;
+ return 0;
pdata->otg_en_gpio = devm_fwnode_gpiod_get_index(&pdev->dev,
of_fwnode_handle(subchild),
@@ -130,13 +130,14 @@ static void bq257xx_reg_dt_parse_gpio(struct platform_device *pdev)
if (PTR_ERR(pdata->otg_en_gpio) == -ENOENT) {
/* No GPIO, will only use register writes for OTG */
pdata->otg_en_gpio = NULL;
- return;
+ return 0;
}
- dev_err(&pdev->dev, "Error getting enable gpio: %ld\n",
- PTR_ERR(pdata->otg_en_gpio));
- return;
+ return dev_err_probe(&pdev->dev, PTR_ERR(pdata->otg_en_gpio),
+ "Error getting enable gpio\n");
}
+
+ return 0;
}
static int bq257xx_regulator_probe(struct platform_device *pdev)
@@ -144,6 +145,7 @@ static int bq257xx_regulator_probe(struct platform_device *pdev)
struct device *dev = &pdev->dev;
struct bq257xx_reg_data *pdata;
struct regulator_config cfg = {};
+ int ret;
device_set_of_node_from_dev(&pdev->dev, pdev->dev.parent);
@@ -154,7 +156,9 @@ static int bq257xx_regulator_probe(struct platform_device *pdev)
pdata->desc = bq25703_vbus_desc;
platform_set_drvdata(pdev, pdata);
- bq257xx_reg_dt_parse_gpio(pdev);
+ ret = bq257xx_reg_dt_parse_gpio(pdev);
+ if (ret)
+ return ret;
cfg.dev = &pdev->dev;
cfg.driver_data = pdata;
--
2.56.0.385.gac671c819a-goog
next prev parent reply other threads:[~2026-11-04 18:22 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-04 18:20 [PATCH 00/10] regulator: Fix teardown races, reference counting, and error handling Lee Jones
2026-11-04 18:20 ` [PATCH 01/10] regulator: irq_helpers: Clear caller handle in regulator_irq_helper_cancel() Lee Jones
2026-11-04 18:20 ` [PATCH 02/10] regulator: arizona-ldo1: Avoid double gpiod_put() on enable GPIO Lee Jones
2026-11-04 18:20 ` [PATCH 03/10] regulator: core: Flush delayed disable_work before releasing supply in regulator_unregister() Lee Jones
2026-11-04 18:20 ` [PATCH 04/10] regulator: arizona-micsupp: Cancel check_cp_work on device teardown Lee Jones
2026-11-04 18:20 ` [PATCH 05/10] regulator: core: Hold supply device reference until constraints are resolved in regulator_resolve_supply() Lee Jones
2026-11-04 18:20 ` [PATCH 06/10] regulator: core: Use ktime_get_boottime() in set_machine_constraints() Lee Jones
2026-11-04 18:20 ` Lee Jones [this message]
2026-11-04 18:20 ` [PATCH 08/10] regulator: tps6594-regulator: Fix LDO4 n_voltages in tps6594_ldo_regs Lee Jones
2026-11-04 18:20 ` [PATCH 09/10] regulator: max8907: Avoid NULL idata dereference in max8907_regulator_probe() Lee Jones
2026-11-04 18:21 ` [PATCH 10/10] regulator: rt6190: Check pm_runtime_resume_and_get() return value in rt6190_out_enable() Lee Jones
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261104182148.1176116-8-lee@kernel.org \
--to=lee@kernel.org \
--cc=broonie@kernel.org \
--cc=lgirdwood@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=macromorgan@hotmail.com \
--cc=stable@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®