linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] soc: samsung: Add missing of_node_put in exynos-pmu.c
@ 2022-06-15 13:56 Liang He
  2022-06-20 12:21 ` Krzysztof Kozlowski
  0 siblings, 1 reply; 2+ messages in thread
From: Liang He @ 2022-06-15 13:56 UTC (permalink / raw)
  To: krzysztof.kozlowski, alim.akhtar
  Cc: linux-arm-kernel, linux-samsung-soc, linux-kernel, windhl

In exynos_get_pmu_regmap(), of_find_matching_node() will return a
node pointer with refcount incremented. We should use of_node_put()
for that node pointer. We need a similar code logic in the function
syscon_regmap_lookup_by_compatible().

Signed-off-by: Liang He <windhl@126.com>
---
 changelog:
 v2: (1) use formal name; (2) add a blank line advised by Krzysztof
 v1: fix the missing of_node_put() problem

 drivers/soc/samsung/exynos-pmu.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/drivers/soc/samsung/exynos-pmu.c b/drivers/soc/samsung/exynos-pmu.c
index 732c86ce2be8..ad0a94d1d88d 100644
--- a/drivers/soc/samsung/exynos-pmu.c
+++ b/drivers/soc/samsung/exynos-pmu.c
@@ -108,9 +108,14 @@ struct regmap *exynos_get_pmu_regmap(void)
 {
 	struct device_node *np = of_find_matching_node(NULL,
 						      exynos_pmu_of_device_ids);
-	if (np)
-		return syscon_node_to_regmap(np);
-	return ERR_PTR(-ENODEV);
+	struct regmap *regmap;
+	
+	if (!np)
+		return ERR_PTR(-ENODEV);
+	
+	regmap = syscon_node_to_regmap(np);
+	of_node_put(np);
+	return regmap;
 }
 EXPORT_SYMBOL_GPL(exynos_get_pmu_regmap);
 
-- 
2.25.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH v2] soc: samsung: Add missing of_node_put in exynos-pmu.c
  2022-06-15 13:56 [PATCH v2] soc: samsung: Add missing of_node_put in exynos-pmu.c Liang He
@ 2022-06-20 12:21 ` Krzysztof Kozlowski
  0 siblings, 0 replies; 2+ messages in thread
From: Krzysztof Kozlowski @ 2022-06-20 12:21 UTC (permalink / raw)
  To: Liang He, alim.akhtar; +Cc: linux-arm-kernel, linux-samsung-soc, linux-kernel

On 15/06/2022 15:56, Liang He wrote:
> In exynos_get_pmu_regmap(), of_find_matching_node() will return a
> node pointer with refcount incremented. We should use of_node_put()
> for that node pointer. We need a similar code logic in the function
> syscon_regmap_lookup_by_compatible().
> 
> Signed-off-by: Liang He <windhl@126.com>


Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>


Best regards,
Krzysztof

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-06-20 12:27 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-15 13:56 [PATCH v2] soc: samsung: Add missing of_node_put in exynos-pmu.c Liang He
2022-06-20 12:21 ` Krzysztof Kozlowski

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).