From: "Peng Fan (OSS)" <peng.fan@oss.nxp.com>
To: robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org,
conor+dt@kernel.org, frowand.list@gmail.com,
andriy.shevchenko@linux.intel.com, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org, gregkh@linuxfoundation.org,
linux@armlinux.org.uk, arnd@arndb.de, linus.walleij@linaro.org,
jeremy.kerr@canonical.com
Cc: isaacmanjarres@google.com, hdegoede@redhat.com,
ulf.hansson@linaro.org, rafael@kernel.org,
grant.likely@secretlab.ca, Peng Fan <peng.fan@nxp.com>
Subject: [PATCH V3 1/2] amba: bus: fix refcount leak
Date: Mon, 21 Aug 2023 10:39:27 +0800 [thread overview]
Message-ID: <20230821023928.3324283-1-peng.fan@oss.nxp.com> (raw)
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
next reply other threads:[~2023-08-21 2:34 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-21 2:39 Peng Fan (OSS) [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230821023928.3324283-1-peng.fan@oss.nxp.com \
--to=peng.fan@oss.nxp.com \
--cc=andriy.shevchenko@linux.intel.com \
--cc=arnd@arndb.de \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=frowand.list@gmail.com \
--cc=grant.likely@secretlab.ca \
--cc=gregkh@linuxfoundation.org \
--cc=hdegoede@redhat.com \
--cc=isaacmanjarres@google.com \
--cc=jeremy.kerr@canonical.com \
--cc=krzysztof.kozlowski+dt@linaro.org \
--cc=linus.walleij@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=peng.fan@nxp.com \
--cc=rafael@kernel.org \
--cc=robh+dt@kernel.org \
--cc=ulf.hansson@linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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®