* [PATCH v1] PCI: rcar: Release temporary device tree node reference
@ 2026-08-01 23:38 Yuho Choi
2026-08-01 23:42 ` sashiko-bot
2026-08-02 2:20 ` Marek Vasut
0 siblings, 2 replies; 3+ messages in thread
From: Yuho Choi @ 2026-08-01 23:38 UTC (permalink / raw)
To: marek.vasut+renesas, yoshihiro.shimoda.uh, lpieralisi,
kwilczynski, mani, bhelgaas, geert+renesas, magnus.damm
Cc: robh, linux-pci, linux-renesas-soc, linux-kernel, Yuho Choi
of_find_matching_node() returns a referenced node even when it is used
only as a boolean test. Keep the result in a scoped cleanup variable
so the reference is released after the match check.
Fixes: a115b1bd3af0 ("PCI: rcar: Add L1 link state fix into data abort hook")
Signed-off-by: Yuho Choi <dbgh9129@gmail.com>
---
drivers/pci/controller/pcie-rcar-host.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/pci/controller/pcie-rcar-host.c b/drivers/pci/controller/pcie-rcar-host.c
index cd9171eebc28..7ed1bc0732ce 100644
--- a/drivers/pci/controller/pcie-rcar-host.c
+++ b/drivers/pci/controller/pcie-rcar-host.c
@@ -1122,7 +1122,10 @@ static const struct of_device_id rcar_pcie_abort_handler_of_match[] __initconst
static int __init rcar_pcie_init(void)
{
- if (of_find_matching_node(NULL, rcar_pcie_abort_handler_of_match)) {
+ struct device_node *np __free(device_node) =
+ of_find_matching_node(NULL, rcar_pcie_abort_handler_of_match);
+
+ if (np) {
#ifdef CONFIG_ARM_LPAE
hook_fault_code(17, rcar_pcie_aarch32_abort_handler, SIGBUS, 0,
"asynchronous external abort");
--
2.43.0
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH v1] PCI: rcar: Release temporary device tree node reference 2026-08-01 23:38 [PATCH v1] PCI: rcar: Release temporary device tree node reference Yuho Choi @ 2026-08-01 23:42 ` sashiko-bot 2026-08-02 2:20 ` Marek Vasut 1 sibling, 0 replies; 3+ messages in thread From: sashiko-bot @ 2026-08-01 23:42 UTC (permalink / raw) To: Yuho Choi; +Cc: linux-pci, wsa+renesas > of_find_matching_node() returns a referenced node even when it is used > only as a boolean test. Keep the result in a scoped cleanup variable > so the reference is released after the match check. > > Fixes: a115b1bd3af0 ("PCI: rcar: Add L1 link state fix into data abort hook") > Signed-off-by: Yuho Choi <dbgh9129@gmail.com> Sashiko has reviewed this patch and found no issues. It looks great! -- Sashiko AI review · https://sashiko.dev/#/patchset/20260801233841.469826-1-dbgh9129@gmail.com?part=1 ^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v1] PCI: rcar: Release temporary device tree node reference 2026-08-01 23:38 [PATCH v1] PCI: rcar: Release temporary device tree node reference Yuho Choi 2026-08-01 23:42 ` sashiko-bot @ 2026-08-02 2:20 ` Marek Vasut 1 sibling, 0 replies; 3+ messages in thread From: Marek Vasut @ 2026-08-02 2:20 UTC (permalink / raw) To: Yuho Choi, marek.vasut+renesas, yoshihiro.shimoda.uh, lpieralisi, kwilczynski, mani, bhelgaas, geert+renesas, magnus.damm Cc: robh, linux-pci, linux-renesas-soc, linux-kernel On 8/2/26 1:38 AM, Yuho Choi wrote: > of_find_matching_node() returns a referenced node even when it is used > only as a boolean test. Keep the result in a scoped cleanup variable > so the reference is released after the match check. > > Fixes: a115b1bd3af0 ("PCI: rcar: Add L1 link state fix into data abort hook") > Signed-off-by: Yuho Choi <dbgh9129@gmail.com> > --- > drivers/pci/controller/pcie-rcar-host.c | 5 ++++- > 1 file changed, 4 insertions(+), 1 deletion(-) > > diff --git a/drivers/pci/controller/pcie-rcar-host.c b/drivers/pci/controller/pcie-rcar-host.c > index cd9171eebc28..7ed1bc0732ce 100644 > --- a/drivers/pci/controller/pcie-rcar-host.c > +++ b/drivers/pci/controller/pcie-rcar-host.c > @@ -1122,7 +1122,10 @@ static const struct of_device_id rcar_pcie_abort_handler_of_match[] __initconst > > static int __init rcar_pcie_init(void) > { > - if (of_find_matching_node(NULL, rcar_pcie_abort_handler_of_match)) { > + struct device_node *np __free(device_node) = > + of_find_matching_node(NULL, rcar_pcie_abort_handler_of_match); > + > + if (np) { > #ifdef CONFIG_ARM_LPAE > hook_fault_code(17, rcar_pcie_aarch32_abort_handler, SIGBUS, 0, > "asynchronous external abort"); How about this simpler version: " diff --git a/drivers/pci/controller/pcie-rcar-host.c b/drivers/pci/controller/pcie-rcar-host.c index 213028052aa58..a4a42e435947f 100644 --- a/drivers/pci/controller/pcie-rcar-host.c +++ b/drivers/pci/controller/pcie-rcar-host.c @@ -1123,7 +1123,9 @@ static const struct of_device_id rcar_pcie_abort_handler_of_match[] __initconst static int __init rcar_pcie_init(void) { - if (of_find_matching_node(NULL, rcar_pcie_abort_handler_of_match)) { + struct device_node *np = of_find_matching_node(NULL, rcar_pcie_abort_handler_of_match); + if (np) { + of_node_put(np); #ifdef CONFIG_ARM_LPAE hook_fault_code(17, rcar_pcie_aarch32_abort_handler, SIGBUS, 0, "asynchronous external abort"); " Also, and this is more of a question for DT maintainers, would it make sense to introduce of_find_matching_node_and_match() variant called e.g. of_test_matching_node_exists() which would return boolean and would NOT call of_node_get() on the matched node in the first place, and then use it here ? ^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-08-02 3:35 UTC | newest] Thread overview: 3+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2026-08-01 23:38 [PATCH v1] PCI: rcar: Release temporary device tree node reference Yuho Choi 2026-08-01 23:42 ` sashiko-bot 2026-08-02 2:20 ` Marek Vasut
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.