* [PATCH 0/2] regulator: fix OF node imbalance on reuse
@ 2026-04-07 9:41 Johan Hovold
2026-04-07 9:41 ` [PATCH 1/2] regulator: bq257xx: fix OF node reference imbalance Johan Hovold
2026-04-07 9:41 ` [PATCH 2/2] regulator: rk808: " Johan Hovold
0 siblings, 2 replies; 6+ messages in thread
From: Johan Hovold @ 2026-04-07 9:41 UTC (permalink / raw)
To: Mark Brown; +Cc: Liam Girdwood, Douglas Anderson, linux-kernel, Johan Hovold
These drivers reuse the OF node of their parent multi-function device
but fail to take another reference to balance the one dropped by the
platform bus code when unbinding the MFD and deregistering the child
devices.
Fix this by using the intended helper for reusing OF nodes.
Note that this may cause a trivial conflict with Doug's series adding
accessor functions for struct device flags:
https://lore.kernel.org/r/20260406232444.3117516-1-dianders@chromium.org
Johan
Johan Hovold (2):
regulator: bq257xx: fix OF node reference imbalance
regulator: rk808: fix OF node reference imbalance
drivers/regulator/bq257xx-regulator.c | 3 +--
drivers/regulator/rk808-regulator.c | 3 +--
2 files changed, 2 insertions(+), 4 deletions(-)
--
2.52.0
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 1/2] regulator: bq257xx: fix OF node reference imbalance
2026-04-07 9:41 [PATCH 0/2] regulator: fix OF node imbalance on reuse Johan Hovold
@ 2026-04-07 9:41 ` Johan Hovold
2026-04-08 0:57 ` Doug Anderson
2026-04-07 9:41 ` [PATCH 2/2] regulator: rk808: " Johan Hovold
1 sibling, 1 reply; 6+ messages in thread
From: Johan Hovold @ 2026-04-07 9:41 UTC (permalink / raw)
To: Mark Brown
Cc: Liam Girdwood, Douglas Anderson, linux-kernel, Johan Hovold,
stable, Chris Morgan
The driver reuses the OF node of the parent multi-function device but
fails to take another reference to balance the one dropped by the
platform bus code when unbinding the MFD and deregistering the child
devices.
Fix this by using the intended helper for reusing OF nodes.
Fixes: 981dd162b635 ("regulator: bq257xx: Add bq257xx boost regulator driver")
Cc: stable@vger.kernel.org # 6.18
Cc: Chris Morgan <macromorgan@hotmail.com>
Signed-off-by: Johan Hovold <johan@kernel.org>
---
drivers/regulator/bq257xx-regulator.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/regulator/bq257xx-regulator.c b/drivers/regulator/bq257xx-regulator.c
index dab8f1ab4450..711dbe045383 100644
--- a/drivers/regulator/bq257xx-regulator.c
+++ b/drivers/regulator/bq257xx-regulator.c
@@ -142,8 +142,7 @@ static int bq257xx_regulator_probe(struct platform_device *pdev)
struct device_node *np = dev->of_node;
struct regulator_config cfg = {};
- pdev->dev.of_node = pdev->dev.parent->of_node;
- pdev->dev.of_node_reused = true;
+ device_set_of_node_from_dev(&pdev->dev, pdev->dev.parent);
pdata = devm_kzalloc(&pdev->dev, sizeof(struct bq257xx_reg_data), GFP_KERNEL);
if (!pdata)
--
2.52.0
^ permalink raw reply related [flat|nested] 6+ messages in thread* Re: [PATCH 1/2] regulator: bq257xx: fix OF node reference imbalance
2026-04-07 9:41 ` [PATCH 1/2] regulator: bq257xx: fix OF node reference imbalance Johan Hovold
@ 2026-04-08 0:57 ` Doug Anderson
0 siblings, 0 replies; 6+ messages in thread
From: Doug Anderson @ 2026-04-08 0:57 UTC (permalink / raw)
To: Johan Hovold
Cc: Mark Brown, Liam Girdwood, linux-kernel, stable, Chris Morgan
Hi,
On Tue, Apr 7, 2026 at 2:42 AM Johan Hovold <johan@kernel.org> wrote:
>
> The driver reuses the OF node of the parent multi-function device but
> fails to take another reference to balance the one dropped by the
> platform bus code when unbinding the MFD and deregistering the child
> devices.
>
> Fix this by using the intended helper for reusing OF nodes.
>
> Fixes: 981dd162b635 ("regulator: bq257xx: Add bq257xx boost regulator driver")
> Cc: stable@vger.kernel.org # 6.18
> Cc: Chris Morgan <macromorgan@hotmail.com>
> Signed-off-by: Johan Hovold <johan@kernel.org>
> ---
> drivers/regulator/bq257xx-regulator.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
Reviewed-by: Douglas Anderson <dianders@chromium.org>
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 2/2] regulator: rk808: fix OF node reference imbalance
2026-04-07 9:41 [PATCH 0/2] regulator: fix OF node imbalance on reuse Johan Hovold
2026-04-07 9:41 ` [PATCH 1/2] regulator: bq257xx: fix OF node reference imbalance Johan Hovold
@ 2026-04-07 9:41 ` Johan Hovold
2026-04-07 10:41 ` Sebastian Reichel
2026-04-08 0:57 ` Doug Anderson
1 sibling, 2 replies; 6+ messages in thread
From: Johan Hovold @ 2026-04-07 9:41 UTC (permalink / raw)
To: Mark Brown
Cc: Liam Girdwood, Douglas Anderson, linux-kernel, Johan Hovold,
stable, Sebastian Reichel
The driver reuses the OF node of the parent multi-function device but
fails to take another reference to balance the one dropped by the
platform bus code when unbinding the MFD and deregistering the child
devices.
Fix this by using the intended helper for reusing OF nodes.
Fixes: 5111c931f36c ("regulator: rk808: cleanup parent device usage")
Cc: stable@vger.kernel.org # 6.5
Cc: Sebastian Reichel <sebastian.reichel@collabora.com>
Signed-off-by: Johan Hovold <johan@kernel.org>
---
drivers/regulator/rk808-regulator.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/regulator/rk808-regulator.c b/drivers/regulator/rk808-regulator.c
index e66408f23bb6..1e956153427e 100644
--- a/drivers/regulator/rk808-regulator.c
+++ b/drivers/regulator/rk808-regulator.c
@@ -2114,8 +2114,7 @@ static int rk808_regulator_probe(struct platform_device *pdev)
struct regmap *regmap;
int ret, i, nregulators;
- pdev->dev.of_node = pdev->dev.parent->of_node;
- pdev->dev.of_node_reused = true;
+ device_set_of_node_from_dev(&pdev->dev, pdev->dev.parent);
regmap = dev_get_regmap(pdev->dev.parent, NULL);
if (!regmap)
--
2.52.0
^ permalink raw reply related [flat|nested] 6+ messages in thread* Re: [PATCH 2/2] regulator: rk808: fix OF node reference imbalance
2026-04-07 9:41 ` [PATCH 2/2] regulator: rk808: " Johan Hovold
@ 2026-04-07 10:41 ` Sebastian Reichel
2026-04-08 0:57 ` Doug Anderson
1 sibling, 0 replies; 6+ messages in thread
From: Sebastian Reichel @ 2026-04-07 10:41 UTC (permalink / raw)
To: Johan Hovold
Cc: Mark Brown, Liam Girdwood, Douglas Anderson, linux-kernel, stable
[-- Attachment #1: Type: text/plain, Size: 1407 bytes --]
Hi,
On Tue, Apr 07, 2026 at 11:41:56AM +0200, Johan Hovold wrote:
> The driver reuses the OF node of the parent multi-function device but
> fails to take another reference to balance the one dropped by the
> platform bus code when unbinding the MFD and deregistering the child
> devices.
>
> Fix this by using the intended helper for reusing OF nodes.
>
> Fixes: 5111c931f36c ("regulator: rk808: cleanup parent device usage")
> Cc: stable@vger.kernel.org # 6.5
> Cc: Sebastian Reichel <sebastian.reichel@collabora.com>
> Signed-off-by: Johan Hovold <johan@kernel.org>
> ---
Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.com>
-- Sebastian
> drivers/regulator/rk808-regulator.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/regulator/rk808-regulator.c b/drivers/regulator/rk808-regulator.c
> index e66408f23bb6..1e956153427e 100644
> --- a/drivers/regulator/rk808-regulator.c
> +++ b/drivers/regulator/rk808-regulator.c
> @@ -2114,8 +2114,7 @@ static int rk808_regulator_probe(struct platform_device *pdev)
> struct regmap *regmap;
> int ret, i, nregulators;
>
> - pdev->dev.of_node = pdev->dev.parent->of_node;
> - pdev->dev.of_node_reused = true;
> + device_set_of_node_from_dev(&pdev->dev, pdev->dev.parent);
>
> regmap = dev_get_regmap(pdev->dev.parent, NULL);
> if (!regmap)
> --
> 2.52.0
>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [PATCH 2/2] regulator: rk808: fix OF node reference imbalance
2026-04-07 9:41 ` [PATCH 2/2] regulator: rk808: " Johan Hovold
2026-04-07 10:41 ` Sebastian Reichel
@ 2026-04-08 0:57 ` Doug Anderson
1 sibling, 0 replies; 6+ messages in thread
From: Doug Anderson @ 2026-04-08 0:57 UTC (permalink / raw)
To: Johan Hovold
Cc: Mark Brown, Liam Girdwood, linux-kernel, stable,
Sebastian Reichel
Hi,
On Tue, Apr 7, 2026 at 2:42 AM Johan Hovold <johan@kernel.org> wrote:
>
> The driver reuses the OF node of the parent multi-function device but
> fails to take another reference to balance the one dropped by the
> platform bus code when unbinding the MFD and deregistering the child
> devices.
>
> Fix this by using the intended helper for reusing OF nodes.
>
> Fixes: 5111c931f36c ("regulator: rk808: cleanup parent device usage")
I don't think this is quite the right "Fixes". Even before that
commit, the driver copied the parent's "of_node" and still set
"of_node_reused".
The first place I see the parent's "of_node" being copied is actually
commit 647e57351f8e ("regulator: rk808: reduce 'struct rk808' usage").
"of_node_reused" is first set in commit 1b9e86d445a0 ("regulator:
rk808: fix asynchronous probing"), but really that should have been
set in the beginning anyway...
Other than that:
Reviewed-by: Douglas Anderson <dianders@chromium.org>
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2026-04-08 0:57 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-07 9:41 [PATCH 0/2] regulator: fix OF node imbalance on reuse Johan Hovold
2026-04-07 9:41 ` [PATCH 1/2] regulator: bq257xx: fix OF node reference imbalance Johan Hovold
2026-04-08 0:57 ` Doug Anderson
2026-04-07 9:41 ` [PATCH 2/2] regulator: rk808: " Johan Hovold
2026-04-07 10:41 ` Sebastian Reichel
2026-04-08 0:57 ` Doug Anderson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox