Skip to content

Commit 147359e

Browse files
javiercarrascocruzWilliam Breathitt Gray
authored andcommitted
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: [email protected] Fixes: 29646ee ("counter: stm32-timer-cnt: add checks on quadrature encoder capability") Signed-off-by: Javier Carrasco <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: William Breathitt Gray <[email protected]>
1 parent 9852d85 commit 147359e

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

drivers/counter/stm32-timer-cnt.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -694,6 +694,7 @@ static int stm32_timer_cnt_probe_encoder(struct device *dev,
694694
}
695695

696696
ret = of_property_read_u32(tnode, "reg", &idx);
697+
of_node_put(tnode);
697698
if (ret) {
698699
dev_err(dev, "Can't get index (%d)\n", ret);
699700
return ret;

0 commit comments

Comments
 (0)