]> www.infradead.org Git - users/jedix/linux-maple.git/commit
clocksource/drivers/timer-ti-dm: Fix child node refcount handling
authorJavier Carrasco <javier.carrasco.cruz@gmail.com>
Thu, 31 Oct 2024 12:54:23 +0000 (13:54 +0100)
committerDaniel Lezcano <daniel.lezcano@linaro.org>
Wed, 13 Nov 2024 12:49:33 +0000 (13:49 +0100)
commite5cfc0989d9a2849c51c720a16b90b2c061a1aeb
treee1cdb285ef5f51be3a73998a2d90dcf26d442611
parentae4705e1b1bc4dedceb6b0956509e3eb2fedaaf1
clocksource/drivers/timer-ti-dm: Fix child node refcount handling

of_find_compatible_node() increments the node's refcount, and it must be
decremented again with a call to of_node_put() when the pointer is no
longer required to avoid leaking the resource.

Instead of adding the missing calls to of_node_put() in all execution
paths, use the cleanup attribute for 'arm_timer' by means of the
__free() macro, which automatically calls of_node_put() when the
variable goes out of scope.

Fixes: 25de4ce5ed02 ("clocksource/drivers/timer-ti-dm: Handle dra7 timer wrap errata i940")
Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com>
Link: https://lore.kernel.org/r/20241031-timer-ti-dm-systimer-of_node_put-v3-1-063ee822b73a@gmail.com
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
drivers/clocksource/timer-ti-dm-systimer.c