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.

Signed-off-by: Ai Chao <aic...@kylinos.cn>
---
 sound/ppc/tumbler.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/sound/ppc/tumbler.c b/sound/ppc/tumbler.c
index 3c09660e1522..b81d0789b9fb 100644
--- a/sound/ppc/tumbler.c
+++ b/sound/ppc/tumbler.c
@@ -1343,7 +1343,7 @@ int snd_pmac_tumbler_init(struct snd_pmac *chip)
        int i, err;
        struct pmac_tumbler *mix;
        const u32 *paddr;
-       struct device_node *tas_node, *np;
+       struct device_node *tas_node;
        char *chipname;
 
        request_module("i2c-powermac");
@@ -1358,13 +1358,12 @@ int snd_pmac_tumbler_init(struct snd_pmac *chip)
        mix->anded_reset = 0;
        mix->reset_on_sleep = 1;
 
-       for_each_child_of_node(chip->node, np) {
+       for_each_child_of_node_scoped(chip->node, np) {
                if (of_node_name_eq(np, "sound")) {
                        if (of_property_read_bool(np, "has-anded-reset"))
                                mix->anded_reset = 1;
                        if (of_property_present(np, "layout-id"))
                                mix->reset_on_sleep = 0;
-                       of_node_put(np);
                        break;
                }
        }
-- 
2.47.1


Reply via email to