* [PATCH] MIPS: Octeon: add missing of_node_put()
@ 2018-06-16 7:06 Nicholas Mc Guire
0 siblings, 0 replies; 2+ messages in thread
From: Nicholas Mc Guire @ 2018-06-16 7:06 UTC (permalink / raw)
To: Ralf Baechle
Cc: Paul Burton, James Hogan, linux-mips, linux-kernel, Nicholas Mc Guire
The call to of_find_node_by_name returns a node pointer with refcount
incremented thus it must be explicitly decremented here after the last
usage.
Signed-off-by: Nicholas Mc Guire <hofrat@osadl.org>
---
Patch found by experimental coccinelle script
Patch was compile tested with: cavium_octeon_defconfig
(with a number of sparse warnings - not related to the proposed change)
Patch is against 4.17.0 (localversion-next is next-20180614)
arch/mips/cavium-octeon/octeon-platform.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/arch/mips/cavium-octeon/octeon-platform.c b/arch/mips/cavium-octeon/octeon-platform.c
index 8505db4..1d92efb 100644
--- a/arch/mips/cavium-octeon/octeon-platform.c
+++ b/arch/mips/cavium-octeon/octeon-platform.c
@@ -320,10 +320,11 @@ static int __init octeon_ehci_device_init(void)
ehci_node = of_find_node_by_name(NULL, "ehci");
if (!ehci_node)
return 0;
pd = of_find_device_by_node(ehci_node);
+ of_node_put(ehci_node);
if (!pd)
return 0;
pd->dev.platform_data = &octeon_ehci_pdata;
octeon_ehci_hw_start(&pd->dev);
@@ -382,10 +383,11 @@ static int __init octeon_ohci_device_init(void)
ohci_node = of_find_node_by_name(NULL, "ohci");
if (!ohci_node)
return 0;
pd = of_find_device_by_node(ohci_node);
+ of_node_put(ohci_node);
if (!pd)
return 0;
pd->dev.platform_data = &octeon_ohci_pdata;
octeon_ohci_hw_start(&pd->dev);
--
2.1.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [PATCH] MIPS: Octeon: add missing of_node_put()
@ 2018-06-16 7:49 Nicholas Mc Guire
0 siblings, 0 replies; 2+ messages in thread
From: Nicholas Mc Guire @ 2018-06-16 7:49 UTC (permalink / raw)
To: Ralf Baechle
Cc: Paul Burton, James Hogan, Steven J. Hill, linux-mips,
linux-kernel, Nicholas Mc Guire
The call to of_find_node_by_name inside the do-while-loop is returning
node with refcount incremented thus it must be explicitly decremented
here after usage.
Signed-off-by: Nicholas Mc Guire <hofrat@osadl.org>
commit 93e502b3c2d4 ("MIPS: OCTEON: Platform support for OCTEON III USB controller")
---
Problem located by an experimental coccinelle script
Patch was compile tested with: cavium_octeon_defconfig (implies
CONFIG_USB=y)
(with a number of sparse warnings - not related to the proposed change)
Patch is against 4.17.0 (localversion-next is next-20180614)
arch/mips/cavium-octeon/octeon-usb.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/arch/mips/cavium-octeon/octeon-usb.c b/arch/mips/cavium-octeon/octeon-usb.c
index bfdfaf3..76e06b4 100644
--- a/arch/mips/cavium-octeon/octeon-usb.c
+++ b/arch/mips/cavium-octeon/octeon-usb.c
@@ -512,6 +512,7 @@ static int __init dwc3_octeon_device_init(void)
if (of_device_is_compatible(node, compat_node_name)) {
pdev = of_find_device_by_node(node);
+ of_node_put(node);
if (!pdev)
return -ENODEV;
--
2.1.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-06-16 7:52 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-06-16 7:06 [PATCH] MIPS: Octeon: add missing of_node_put() Nicholas Mc Guire
2018-06-16 7:49 Nicholas Mc Guire
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).