* [PATCH] regulator: bq257xx: drop confusing configuration of_node
@ 2026-04-08 12:53 Johan Hovold
2026-04-08 13:18 ` Mark Brown
2026-06-03 14:43 ` Johan Hovold
0 siblings, 2 replies; 7+ messages in thread
From: Johan Hovold @ 2026-04-08 12:53 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>
---
This is a follow-up to the reused OF node imbalance series:
https://lore.kernel.org/lkml/20260408073055.5183-1-johan@kernel.org/
to address a false-positive Sashiko report.
Johan
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 711dbe045383..86225566e10a 100644
--- a/drivers/regulator/bq257xx-regulator.c
+++ b/drivers/regulator/bq257xx-regulator.c
@@ -139,7 +139,6 @@ static int bq257xx_regulator_probe(struct platform_device *pdev)
struct device *dev = &pdev->dev;
struct bq257xx_device *bq = dev_get_drvdata(pdev->dev.parent);
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);
@@ -156,7 +155,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.52.0
^ permalink raw reply related [flat|nested] 7+ messages in thread* Re: [PATCH] regulator: bq257xx: drop confusing configuration of_node
2026-04-08 12:53 [PATCH] regulator: bq257xx: drop confusing configuration of_node Johan Hovold
@ 2026-04-08 13:18 ` Mark Brown
2026-04-08 13:19 ` Mark Brown
2026-06-03 14:43 ` Johan Hovold
1 sibling, 1 reply; 7+ messages in thread
From: Mark Brown @ 2026-04-08 13:18 UTC (permalink / raw)
To: Johan Hovold; +Cc: Liam Girdwood, linux-kernel, Chris Morgan
[-- Attachment #1: Type: text/plain, Size: 2119 bytes --]
On Wed, Apr 08, 2026 at 02:53:47PM +0200, Johan Hovold wrote:
> 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.
Copying in Chris.
> 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>
> ---
>
> This is a follow-up to the reused OF node imbalance series:
>
> https://lore.kernel.org/lkml/20260408073055.5183-1-johan@kernel.org/
>
> to address a false-positive Sashiko report.
>
> Johan
>
>
> 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 711dbe045383..86225566e10a 100644
> --- a/drivers/regulator/bq257xx-regulator.c
> +++ b/drivers/regulator/bq257xx-regulator.c
> @@ -139,7 +139,6 @@ static int bq257xx_regulator_probe(struct platform_device *pdev)
> struct device *dev = &pdev->dev;
> struct bq257xx_device *bq = dev_get_drvdata(pdev->dev.parent);
> 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);
> @@ -156,7 +155,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.52.0
>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread* Re: [PATCH] regulator: bq257xx: drop confusing configuration of_node
2026-04-08 13:18 ` Mark Brown
@ 2026-04-08 13:19 ` Mark Brown
0 siblings, 0 replies; 7+ messages in thread
From: Mark Brown @ 2026-04-08 13:19 UTC (permalink / raw)
To: Johan Hovold; +Cc: Liam Girdwood, linux-kernel, Chris Morgan
[-- Attachment #1: Type: text/plain, Size: 366 bytes --]
On Wed, Apr 08, 2026 at 02:18:22PM +0100, Mark Brown wrote:
> On Wed, Apr 08, 2026 at 02:53:47PM +0200, Johan Hovold wrote:
> > 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.
>
> Copying in Chris.
Or not since hotmail is blocking kernel.org.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] regulator: bq257xx: drop confusing configuration of_node
2026-04-08 12:53 [PATCH] regulator: bq257xx: drop confusing configuration of_node Johan Hovold
2026-04-08 13:18 ` Mark Brown
@ 2026-06-03 14:43 ` Johan Hovold
2026-06-03 19:14 ` Mark Brown
1 sibling, 1 reply; 7+ messages in thread
From: Johan Hovold @ 2026-06-03 14:43 UTC (permalink / raw)
To: Mark Brown; +Cc: Liam Girdwood, linux-kernel
On Wed, Apr 08, 2026 at 02:53:47PM +0200, Johan Hovold wrote:
> 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>
> ---
>
> This is a follow-up to the reused OF node imbalance series:
>
> https://lore.kernel.org/lkml/20260408073055.5183-1-johan@kernel.org/
>
> to address a false-positive Sashiko report.
Can this one be picked up now?
Johan
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] regulator: bq257xx: drop confusing configuration of_node
2026-06-03 14:43 ` Johan Hovold
@ 2026-06-03 19:14 ` Mark Brown
2026-06-04 6:55 ` Johan Hovold
0 siblings, 1 reply; 7+ messages in thread
From: Mark Brown @ 2026-06-03 19:14 UTC (permalink / raw)
To: Johan Hovold; +Cc: Liam Girdwood, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 385 bytes --]
On Wed, Jun 03, 2026 at 04:43:12PM +0200, Johan Hovold wrote:
> On Wed, Apr 08, 2026 at 02:53:47PM +0200, Johan Hovold wrote:
> > 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.
> Can this one be picked up now?
I have no idea what it was supposed to be applied against.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] regulator: bq257xx: drop confusing configuration of_node
2026-06-03 19:14 ` Mark Brown
@ 2026-06-04 6:55 ` Johan Hovold
2026-06-04 10:03 ` Mark Brown
0 siblings, 1 reply; 7+ messages in thread
From: Johan Hovold @ 2026-06-04 6:55 UTC (permalink / raw)
To: Mark Brown; +Cc: Liam Girdwood, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 561 bytes --]
On Wed, Jun 03, 2026 at 08:14:28PM +0100, Mark Brown wrote:
> On Wed, Jun 03, 2026 at 04:43:12PM +0200, Johan Hovold wrote:
> > On Wed, Apr 08, 2026 at 02:53:47PM +0200, Johan Hovold wrote:
>
> > > 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.
>
> > Can this one be picked up now?
>
> I have no idea what it was supposed to be applied against.
Since it does not fix a bug it can go in your regulator for-next branch.
Johan
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 265 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] regulator: bq257xx: drop confusing configuration of_node
2026-06-04 6:55 ` Johan Hovold
@ 2026-06-04 10:03 ` Mark Brown
0 siblings, 0 replies; 7+ messages in thread
From: Mark Brown @ 2026-06-04 10:03 UTC (permalink / raw)
To: Johan Hovold; +Cc: Liam Girdwood, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 371 bytes --]
On Thu, Jun 04, 2026 at 08:55:00AM +0200, Johan Hovold wrote:
> On Wed, Jun 03, 2026 at 08:14:28PM +0100, Mark Brown wrote:
> > I have no idea what it was supposed to be applied against.
> Since it does not fix a bug it can go in your regulator for-next branch.
No, I mean in the technical sense that I couldn't work out something
that the git am operation worked on.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2026-06-04 10:03 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-08 12:53 [PATCH] regulator: bq257xx: drop confusing configuration of_node Johan Hovold
2026-04-08 13:18 ` Mark Brown
2026-04-08 13:19 ` Mark Brown
2026-06-03 14:43 ` Johan Hovold
2026-06-03 19:14 ` Mark Brown
2026-06-04 6:55 ` Johan Hovold
2026-06-04 10:03 ` Mark Brown
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.