diff mbox series

interconnect: fix memory trashing in of_count_icc_providers()

Message ID 20201119103746.32564-1-m.szyprowski@samsung.com (mailing list archive)
State Not Applicable, archived
Headers show
Series interconnect: fix memory trashing in of_count_icc_providers() | expand

Commit Message

Marek Szyprowski Nov. 19, 2020, 10:37 a.m. UTC
of_count_icc_providers() function uses for_each_available_child_of_node()
helper to recursively check all the available nodes. This helper already
properly handles child nodes' reference count, so there is no need to do
it explicitely. Remove the excessive call to of_node_put(). This fixes
memory trashing when CONFIG_OF_DYNAMIC is enabled (for example
arm/multi_v7_defconfig).

Fixes: b1d681d8d324 ("interconnect: Add sync state support")
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
---
 drivers/interconnect/core.c | 1 -
 1 file changed, 1 deletion(-)

Comments

Georgi Djakov Nov. 19, 2020, 1:52 p.m. UTC | #1
On 11/19/20 12:37, Marek Szyprowski wrote:
> of_count_icc_providers() function uses for_each_available_child_of_node()
> helper to recursively check all the available nodes. This helper already
> properly handles child nodes' reference count, so there is no need to do
> it explicitely. Remove the excessive call to of_node_put(). This fixes
> memory trashing when CONFIG_OF_DYNAMIC is enabled (for example
> arm/multi_v7_defconfig).
> 
> Fixes: b1d681d8d324 ("interconnect: Add sync state support")
> Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>

Thanks Marek!

BR,
Georgi

> ---
>   drivers/interconnect/core.c | 1 -
>   1 file changed, 1 deletion(-)
> 
> diff --git a/drivers/interconnect/core.c b/drivers/interconnect/core.c
> index 974a66725d09..5ad519c9f239 100644
> --- a/drivers/interconnect/core.c
> +++ b/drivers/interconnect/core.c
> @@ -1083,7 +1083,6 @@ static int of_count_icc_providers(struct device_node *np)
>   			count++;
>   		count += of_count_icc_providers(child);
>   	}
> -	of_node_put(np);
>   
>   	return count;
>   }
>
diff mbox series

Patch

diff --git a/drivers/interconnect/core.c b/drivers/interconnect/core.c
index 974a66725d09..5ad519c9f239 100644
--- a/drivers/interconnect/core.c
+++ b/drivers/interconnect/core.c
@@ -1083,7 +1083,6 @@  static int of_count_icc_providers(struct device_node *np)
 			count++;
 		count += of_count_icc_providers(child);
 	}
-	of_node_put(np);
 
 	return count;
 }