devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH V3 1/2] amba: bus: fix refcount leak
@ 2023-08-21  2:39 Peng Fan (OSS)
  2023-08-21  2:39 ` [PATCH V3 2/2] of/platform: increase refcount of fwnode Peng Fan (OSS)
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Peng Fan (OSS) @ 2023-08-21  2:39 UTC (permalink / raw)
  To: robh+dt, krzysztof.kozlowski+dt, conor+dt, frowand.list,
	andriy.shevchenko, devicetree, linux-kernel, gregkh, linux, arnd,
	linus.walleij, jeremy.kerr
  Cc: isaacmanjarres, hdegoede, ulf.hansson, rafael, grant.likely,
	Peng Fan

From: Peng Fan <peng.fan@nxp.com>

commit 5de1540b7bc4 ("drivers/amba: create devices from device tree")
increases the refcount of of_node, but not releases it in
amba_device_release, so there is refcount leak. By using of_node_put
to avoid refcount leak.

Fixes: 5de1540b7bc4 ("drivers/amba: create devices from device tree")
Signed-off-by: Peng Fan <peng.fan@nxp.com>
---

Note: Code inspection, not tested.

V3:
 Move this out from patch V2 1/1

 drivers/amba/bus.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/amba/bus.c b/drivers/amba/bus.c
index ce88af9eb562..09e72967b8ab 100644
--- a/drivers/amba/bus.c
+++ b/drivers/amba/bus.c
@@ -528,6 +528,7 @@ static void amba_device_release(struct device *dev)
 {
 	struct amba_device *d = to_amba_device(dev);
 
+	of_node_put(d->dev.of_node);
 	if (d->res.parent)
 		release_resource(&d->res);
 	mutex_destroy(&d->periphid_lock);
-- 
2.37.1


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

end of thread, other threads:[~2023-08-23  8:27 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-08-21  2:39 [PATCH V3 1/2] amba: bus: fix refcount leak Peng Fan (OSS)
2023-08-21  2:39 ` [PATCH V3 2/2] of/platform: increase refcount of fwnode Peng Fan (OSS)
2023-08-21 21:00   ` Rob Herring
2023-08-22 10:28     ` Geert Uytterhoeven
2023-08-21 10:57 ` [PATCH V3 1/2] amba: bus: fix refcount leak Andy Shevchenko
2023-08-23  8:22 ` Linus Walleij

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).