* [PATCH] mips: cavium-octeon: Fix missing of_node_put() in octeon2_usb_clocks_start
@ 2022-07-01 12:41 Liang He
2022-07-05 10:20 ` Thomas Bogendoerfer
0 siblings, 1 reply; 2+ messages in thread
From: Liang He @ 2022-07-01 12:41 UTC (permalink / raw)
To: tsbogend, linux-mips, windhl
We should call of_node_put() for the reference 'uctl_node' returned by
of_get_parent() which will increase the refcount. Otherwise, there will
be a refcount leak bug.
Signed-off-by: Liang He <windhl@126.com>
---
arch/mips/cavium-octeon/octeon-platform.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/arch/mips/cavium-octeon/octeon-platform.c b/arch/mips/cavium-octeon/octeon-platform.c
index a994022e32c9..ce05c0dd3acd 100644
--- a/arch/mips/cavium-octeon/octeon-platform.c
+++ b/arch/mips/cavium-octeon/octeon-platform.c
@@ -86,11 +86,12 @@ static void octeon2_usb_clocks_start(struct device *dev)
"refclk-frequency", &clock_rate);
if (i) {
dev_err(dev, "No UCTL \"refclk-frequency\"\n");
+ of_node_put(uctl_node);
goto exit;
}
i = of_property_read_string(uctl_node,
"refclk-type", &clock_type);
-
+ of_node_put(uctl_node);
if (!i && strcmp("crystal", clock_type) == 0)
is_crystal_clock = true;
}
--
2.25.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] mips: cavium-octeon: Fix missing of_node_put() in octeon2_usb_clocks_start
2022-07-01 12:41 [PATCH] mips: cavium-octeon: Fix missing of_node_put() in octeon2_usb_clocks_start Liang He
@ 2022-07-05 10:20 ` Thomas Bogendoerfer
0 siblings, 0 replies; 2+ messages in thread
From: Thomas Bogendoerfer @ 2022-07-05 10:20 UTC (permalink / raw)
To: Liang He; +Cc: linux-mips
On Fri, Jul 01, 2022 at 08:41:12PM +0800, Liang He wrote:
> We should call of_node_put() for the reference 'uctl_node' returned by
> of_get_parent() which will increase the refcount. Otherwise, there will
> be a refcount leak bug.
>
> Signed-off-by: Liang He <windhl@126.com>
> ---
> arch/mips/cavium-octeon/octeon-platform.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/arch/mips/cavium-octeon/octeon-platform.c b/arch/mips/cavium-octeon/octeon-platform.c
> index a994022e32c9..ce05c0dd3acd 100644
> --- a/arch/mips/cavium-octeon/octeon-platform.c
> +++ b/arch/mips/cavium-octeon/octeon-platform.c
> @@ -86,11 +86,12 @@ static void octeon2_usb_clocks_start(struct device *dev)
> "refclk-frequency", &clock_rate);
> if (i) {
> dev_err(dev, "No UCTL \"refclk-frequency\"\n");
> + of_node_put(uctl_node);
> goto exit;
> }
> i = of_property_read_string(uctl_node,
> "refclk-type", &clock_type);
> -
> + of_node_put(uctl_node);
> if (!i && strcmp("crystal", clock_type) == 0)
> is_crystal_clock = true;
> }
> --
> 2.25.1
applied to mips-next.
Thomas.
--
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a
good idea. [ RFC1925, 2.3 ]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-07-05 10:40 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-01 12:41 [PATCH] mips: cavium-octeon: Fix missing of_node_put() in octeon2_usb_clocks_start Liang He
2022-07-05 10:20 ` Thomas Bogendoerfer
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.