soc: samsung: Add missing of_node_put in exynos-pmu.c
PATCH v2 1/1 soc: samsung: Add missing of_node_put in exynos-pmu.c
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 <[email protected]>
---
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(-)
drivers/soc/samsung/exynos-pmu.c +8 -3
@@ -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);
Signature · 1 line
2.25.1
Quoted 6 lines · Liang He
In
exynos_get_pmu_regmap(),of_find_matching_node()will return a node pointer with refcount incremented. We should useof_node_put()for that node pointer. We need a similar code logic in the functionsyscon_regmap_lookup_by_compatible().Signed-off-by Liang He <[email protected]>
Reviewed-by Krzysztof Kozlowski <[email protected]>
Best regards,
Krzysztof