Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

clocksource/drivers/arm_arch_timer: Using for_each_available_child_of_node_scoped()

for_each_available_child_of_node_scoped() can put the device_node
automatically. So, using it to make the code logic more simple and
remove the device_node clean up code.

Signed-off-by: Zhang Zekun <zhangzekun11@huawei.com>
Link: https://lore.kernel.org/r/20240807074655.52157-1-zhangzekun11@huawei.com
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>

authored by

Zhang Zekun and committed by
Daniel Lezcano
a7456d7d 0c872820

+3 -8
+3 -8
drivers/clocksource/arm_arch_timer.c
··· 1594 1594 { 1595 1595 struct arch_timer_mem *timer_mem; 1596 1596 struct arch_timer_mem_frame *frame; 1597 - struct device_node *frame_node; 1598 1597 struct resource res; 1599 1598 int ret = -EINVAL; 1600 1599 u32 rate; ··· 1607 1608 timer_mem->cntctlbase = res.start; 1608 1609 timer_mem->size = resource_size(&res); 1609 1610 1610 - for_each_available_child_of_node(np, frame_node) { 1611 + for_each_available_child_of_node_scoped(np, frame_node) { 1611 1612 u32 n; 1612 1613 struct arch_timer_mem_frame *frame; 1613 1614 1614 1615 if (of_property_read_u32(frame_node, "frame-number", &n)) { 1615 1616 pr_err(FW_BUG "Missing frame-number.\n"); 1616 - of_node_put(frame_node); 1617 1617 goto out; 1618 1618 } 1619 1619 if (n >= ARCH_TIMER_MEM_MAX_FRAMES) { 1620 1620 pr_err(FW_BUG "Wrong frame-number, only 0-%u are permitted.\n", 1621 1621 ARCH_TIMER_MEM_MAX_FRAMES - 1); 1622 - of_node_put(frame_node); 1623 1622 goto out; 1624 1623 } 1625 1624 frame = &timer_mem->frame[n]; 1626 1625 1627 1626 if (frame->valid) { 1628 1627 pr_err(FW_BUG "Duplicated frame-number.\n"); 1629 - of_node_put(frame_node); 1630 1628 goto out; 1631 1629 } 1632 1630 1633 - if (of_address_to_resource(frame_node, 0, &res)) { 1634 - of_node_put(frame_node); 1631 + if (of_address_to_resource(frame_node, 0, &res)) 1635 1632 goto out; 1636 - } 1633 + 1637 1634 frame->cntbase = res.start; 1638 1635 frame->size = resource_size(&res); 1639 1636