[PATCH 0/2] soc: samsung: exynos-pmu: fix of_node leak and refactor regmap lookup

From: geoffrey

Date: Tue Jun 09 2026 - 06:01:15 EST


From: Weigang He <geoffreyhe2@xxxxxxxxx>

exynos_get_pmu_regmap() leaks the device_node reference taken by
of_find_matching_node(): it passes the node to
exynos_get_pmu_regmap_by_phandle(np, NULL), which with propname == NULL
uses the node directly and never drops the reference.

Patch 1 is the minimal fix: drop the reference in the function that
acquired it. It is small and safe to backport.

Patch 2 is a follow-up cleanup that factors the shared PMU-node lookup
into a helper so that each public function owns and releases only the
node it acquired, removing the need to pass NULL to the by-phandle
helper. It also makes exynos_get_pmu_regmap_by_phandle() reject
propname == NULL with -EINVAL (passing NULL was never a documented use
of that interface). It is a cleanup only and not needed for the fix.

The leak was found by the static analysis tool CodeQL. I do not have
Exynos hardware, so the series has been build-tested only (arm64);
runtime testing on real hardware would be appreciated.

Weigang He (2):
soc: samsung: exynos-pmu: fix of_node refcount leak in
exynos_get_pmu_regmap()
soc: samsung: exynos-pmu: refactor PMU regmap lookup helpers

drivers/soc/samsung/exynos-pmu.c | 71 +++++++++++++++++++-------------
1 file changed, 43 insertions(+), 28 deletions(-)


base-commit: 0f61b1860cc3f52aef9036d7235ed1f017632193
--
2.43.0