[PATCH] soc: rockchip: grf: fix device node refcount leak in error path

Heiko Stübner heiko at sntech.de
Sat Feb 21 06:51:46 PST 2026


Hi,

Am Samstag, 21. Februar 2026, 01:40:27 Mitteleuropäische Normalzeit schrieb xiaopeitux at foxmail.com:
> From: Pei Xiao <xiaopei01 at kylinos.cn>
> 
> The for_each_matching_node_and_match() macro automatically manages device
> node reference counts during normal iteration. However, when breaking out
> of the loop early with return, the current iteration's node is not
> automatically released, leading to a reference count leak.
> 
> Fix this by adding of_node_put() before returning from the loop
> when fails.
> 
> Fixes: 75fb63ae0312 ("soc: rockchip: grf: Support multiple grf to be handled")
> Signed-off-by: Pei Xiao <xiaopei01 at kylinos.cn>

Felix Gu was slightly faster [0], so I'll apply their patch once the merge-
window is closed.

Thanks
Heiko


[0] http://lore.kernel.org/r/20260217-grf-v1-1-2088c966875d@gmail.com





More information about the Linux-rockchip mailing list