* [PATCH] regulator: core: fix unbalanced of node refcount in regulator_dev_lookup()
@ 2022-11-15 9:15 Yang Yingliang
2022-11-15 11:35 ` Mark Brown
0 siblings, 1 reply; 2+ messages in thread
From: Yang Yingliang @ 2022-11-15 9:15 UTC (permalink / raw)
To: linux-kernel; +Cc: lgirdwood, broonie
I got the the following report:
OF: ERROR: memory leak, expected refcount 1 instead of 2,
of_node_get()/of_node_put() unbalanced - destroy cset entry:
attach overlay node /i2c/pmic@62/regulators/exten
In of_get_regulator(), the node is returned from of_parse_phandle()
with refcount incremented, after using it, of_node_put() need be called.
Fixes: 69511a452e6d ("regulator: map consumer regulator based on device tree")
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
---
drivers/regulator/core.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index bcccad8f7516..d63e6a8f569b 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -1943,6 +1943,7 @@ static struct regulator_dev *regulator_dev_lookup(struct device *dev,
node = of_get_regulator(dev, supply);
if (node) {
r = of_find_regulator_by_node(node);
+ of_node_put(node);
if (r)
return r;
--
2.25.1
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] regulator: core: fix unbalanced of node refcount in regulator_dev_lookup()
2022-11-15 9:15 [PATCH] regulator: core: fix unbalanced of node refcount in regulator_dev_lookup() Yang Yingliang
@ 2022-11-15 11:35 ` Mark Brown
0 siblings, 0 replies; 2+ messages in thread
From: Mark Brown @ 2022-11-15 11:35 UTC (permalink / raw)
To: Yang Yingliang, linux-kernel; +Cc: lgirdwood
On Tue, 15 Nov 2022 17:15:08 +0800, Yang Yingliang wrote:
> I got the the following report:
>
> OF: ERROR: memory leak, expected refcount 1 instead of 2,
> of_node_get()/of_node_put() unbalanced - destroy cset entry:
> attach overlay node /i2c/pmic@62/regulators/exten
>
> In of_get_regulator(), the node is returned from of_parse_phandle()
> with refcount incremented, after using it, of_node_put() need be called.
>
> [...]
Applied to
broonie/regulator.git for-next
Thanks!
[1/1] regulator: core: fix unbalanced of node refcount in regulator_dev_lookup()
commit: f2b41b748c19962b82709d9f23c6b2b0ce9d2f91
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:[~2022-11-15 11:35 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-15 9:15 [PATCH] regulator: core: fix unbalanced of node refcount in regulator_dev_lookup() Yang Yingliang
2022-11-15 11:35 ` Mark Brown
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®