]> git.hungrycats.org Git - linux/commit
counter: stm32-timer-cnt: fix device_node handling in probe_encoder()
authorJavier Carrasco <javier.carrasco.cruz@gmail.com>
Sun, 27 Oct 2024 12:26:49 +0000 (13:26 +0100)
committerWilliam Breathitt Gray <wbg@kernel.org>
Fri, 1 Nov 2024 04:46:54 +0000 (13:46 +0900)
commit147359e23e5c9652ff8c5a98a51a7323bd51c94a
treed2423147b9c1e26a1b7930578fbd278a602a9fd5
parent9852d85ec9d492ebef56dc5f229416c925758edc
counter: stm32-timer-cnt: fix device_node handling in probe_encoder()

Device nodes accessed via of_get_compatible_child() require
of_node_put() to be called when the node is no longer required to avoid
leaving a reference to the node behind, leaking the resource.

In this case, the usage of 'tnode' is straightforward and there are no
error paths, allowing for a single of_node_put() when 'tnode' is no
longer required.

Cc: stable@vger.kernel.org
Fixes: 29646ee33cc3 ("counter: stm32-timer-cnt: add checks on quadrature encoder capability")
Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com>
Link: https://lore.kernel.org/r/20241027-stm32-timer-cnt-of_node_put-v1-1-ebd903cdf7ac@gmail.com
Signed-off-by: William Breathitt Gray <wbg@kernel.org>
drivers/counter/stm32-timer-cnt.c