mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v2] regulator: bq257xx: drop confusing configuration of_node
@ 2026-06-04 11:59 Johan Hovold
  2026-06-04 15:59 ` Mark Brown
  0 siblings, 1 reply; 2+ messages in thread
From: Johan Hovold @ 2026-06-04 11:59 UTC (permalink / raw)
  To: Mark Brown; +Cc: Liam Girdwood, linux-kernel, Johan Hovold

The driver reuses the OF node of the parent multi-function device but
still sets the of_node field of the regulator configuration to any prior
OF node.

Since the MFD child device does not have an OF node set until probe is
called, this field is set to NULL on first probe and to the reused OF
node if the driver is later rebound.

As the device_set_of_node_from_dev() helper drops a reference to any
prior OF node before taking a reference to the new one this can
apparently also confuse LLMs like Sashiko which flags it as a potential
use-after-free (which it is not).

Drop the confusing and redundant configuration of_node assignment.

Link: https://sashiko.dev/#/patchset/20260408073055.5183-1-johan%40kernel.org
Signed-off-by: Johan Hovold <johan@kernel.org>
---

Changes in v2:
 - rebase against 7.1-rc6 (and linux-next)


 drivers/regulator/bq257xx-regulator.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/regulator/bq257xx-regulator.c b/drivers/regulator/bq257xx-regulator.c
index 09c466052c04..577b277efd7f 100644
--- a/drivers/regulator/bq257xx-regulator.c
+++ b/drivers/regulator/bq257xx-regulator.c
@@ -143,7 +143,6 @@ static int bq257xx_regulator_probe(struct platform_device *pdev)
 {
 	struct device *dev = &pdev->dev;
 	struct bq257xx_reg_data *pdata;
-	struct device_node *np = dev->of_node;
 	struct regulator_config cfg = {};
 
 	device_set_of_node_from_dev(&pdev->dev, pdev->dev.parent);
@@ -159,7 +158,6 @@ static int bq257xx_regulator_probe(struct platform_device *pdev)
 
 	cfg.dev = &pdev->dev;
 	cfg.driver_data = pdata;
-	cfg.of_node = np;
 	cfg.regmap = dev_get_regmap(pdev->dev.parent, NULL);
 	if (!cfg.regmap)
 		return -ENODEV;
-- 
2.53.0


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH v2] regulator: bq257xx: drop confusing configuration of_node
  2026-06-04 11:59 [PATCH v2] regulator: bq257xx: drop confusing configuration of_node Johan Hovold
@ 2026-06-04 15:59 ` Mark Brown
  0 siblings, 0 replies; 2+ messages in thread
From: Mark Brown @ 2026-06-04 15:59 UTC (permalink / raw)
  To: Johan Hovold; +Cc: Liam Girdwood, linux-kernel

On Thu, 04 Jun 2026 13:59:12 +0200, Johan Hovold wrote:
> regulator: bq257xx: drop confusing configuration of_node

Applied to

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator.git for-7.2

Thanks!

[1/1] regulator: bq257xx: drop confusing configuration of_node
      https://git.kernel.org/broonie/regulator/c/e727fe9be173

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-06-08 13:54 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-06-04 11:59 [PATCH v2] regulator: bq257xx: drop confusing configuration of_node Johan Hovold
2026-06-04 15:59 ` Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome