[PATCH v2 2/6] ASoC: aoa: Use helper function for_each_child_of_node_scoped()
Johannes Berg
johannes at sipsolutions.net
Thu May 22 20:04:23 AEST 2025
On Thu, 2025-05-22 at 13:02 +0800, Ai Chao wrote:
> The for_each_child_of_node_scoped() helper provides a scope-based
> clean-up functionality to put the device_node automatically, and
> as such, there is no need to call of_node_put() directly.
>
> Thus, use this helper to simplify the code.
> - for_each_child_of_node(dev->ofdev.dev.of_node, np) {
> + for_each_child_of_node_scoped(dev->ofdev.dev.of_node, np) {
> if (of_device_is_compatible(np, "i2sbus") ||
> of_device_is_compatible(np, "i2s-modem")) {
> got += i2sbus_add_dev(dev, control, np);
Given the structure of this code, this either fixes a leak, or is wrong.
I really don't know which of those two it is, it's been decades, but
either way it's not a change that simply "simplif[ies] the code".
johannes
More information about the Linuxppc-dev
mailing list