From: Peng Wu <wupeng58@huawei.com> To: <mpe@ellerman.id.au>, <benh@kernel.crashing.org>, <nick.child@ibm.com> Cc: <linuxppc-dev@lists.ozlabs.org>, <linux-kernel@vger.kernel.org>, <liwei391@huawei.com>, <wangxiongfeng2@huawei.com>, Peng Wu <wupeng58@huawei.com> Subject: [PATCH -next] powerpc/iommu: Add missing of_node_put in iommu_init_early_dart Date: Mon, 25 Apr 2022 08:12:45 +0000 [thread overview] Message-ID: <20220425081245.21705-1-wupeng58@huawei.com> (raw) The device_node pointer is returned by of_find_compatible_node with refcount incremented. We should use of_node_put() to avoid the refcount leak. Signed-off-by: Peng Wu <wupeng58@huawei.com> --- arch/powerpc/sysdev/dart_iommu.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/arch/powerpc/sysdev/dart_iommu.c b/arch/powerpc/sysdev/dart_iommu.c index be6b99b1b352..9a02aed886a0 100644 --- a/arch/powerpc/sysdev/dart_iommu.c +++ b/arch/powerpc/sysdev/dart_iommu.c @@ -404,9 +404,10 @@ void __init iommu_init_early_dart(struct pci_controller_ops *controller_ops) } /* Initialize the DART HW */ - if (dart_init(dn) != 0) + if (dart_init(dn) != 0) { + of_node_put(dn); return; - + } /* * U4 supports a DART bypass, we use it for 64-bit capable devices to * improve performance. However, that only works for devices connected @@ -419,6 +420,7 @@ void __init iommu_init_early_dart(struct pci_controller_ops *controller_ops) /* Setup pci_dma ops */ set_pci_dma_ops(&dma_iommu_ops); + of_node_put(dn); } #ifdef CONFIG_PM -- 2.17.1
WARNING: multiple messages have this Message-ID (diff)
From: Peng Wu <wupeng58@huawei.com> To: <mpe@ellerman.id.au>, <benh@kernel.crashing.org>, <nick.child@ibm.com> Cc: Peng Wu <wupeng58@huawei.com>, liwei391@huawei.com, linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, wangxiongfeng2@huawei.com Subject: [PATCH -next] powerpc/iommu: Add missing of_node_put in iommu_init_early_dart Date: Mon, 25 Apr 2022 08:12:45 +0000 [thread overview] Message-ID: <20220425081245.21705-1-wupeng58@huawei.com> (raw) The device_node pointer is returned by of_find_compatible_node with refcount incremented. We should use of_node_put() to avoid the refcount leak. Signed-off-by: Peng Wu <wupeng58@huawei.com> --- arch/powerpc/sysdev/dart_iommu.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/arch/powerpc/sysdev/dart_iommu.c b/arch/powerpc/sysdev/dart_iommu.c index be6b99b1b352..9a02aed886a0 100644 --- a/arch/powerpc/sysdev/dart_iommu.c +++ b/arch/powerpc/sysdev/dart_iommu.c @@ -404,9 +404,10 @@ void __init iommu_init_early_dart(struct pci_controller_ops *controller_ops) } /* Initialize the DART HW */ - if (dart_init(dn) != 0) + if (dart_init(dn) != 0) { + of_node_put(dn); return; - + } /* * U4 supports a DART bypass, we use it for 64-bit capable devices to * improve performance. However, that only works for devices connected @@ -419,6 +420,7 @@ void __init iommu_init_early_dart(struct pci_controller_ops *controller_ops) /* Setup pci_dma ops */ set_pci_dma_ops(&dma_iommu_ops); + of_node_put(dn); } #ifdef CONFIG_PM -- 2.17.1
next reply other threads:[~2022-04-25 8:36 UTC|newest] Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-04-25 8:12 Peng Wu [this message] 2022-04-25 8:12 ` [PATCH -next] powerpc/iommu: Add missing of_node_put in iommu_init_early_dart Peng Wu 2022-05-24 11:09 ` Michael Ellerman 2022-05-24 11:09 ` Michael Ellerman
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=20220425081245.21705-1-wupeng58@huawei.com \ --to=wupeng58@huawei.com \ --cc=benh@kernel.crashing.org \ --cc=linux-kernel@vger.kernel.org \ --cc=linuxppc-dev@lists.ozlabs.org \ --cc=liwei391@huawei.com \ --cc=mpe@ellerman.id.au \ --cc=nick.child@ibm.com \ --cc=wangxiongfeng2@huawei.com \ /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: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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.