ALSA: ppc: Fix of-node refcount unbalance [Linux 5.1]

ALSA: ppc: Fix of-node refcount unbalance [Linux 5.1]

This Linux kernel change "ALSA: ppc: Fix of-node refcount unbalance" is included in the Linux 5.1 release. This change is authored by Takashi Iwai <tiwai [at] suse.de> on Mon Feb 18 15:05:24 2019 +0100. The commit for this change in Linux stable tree is 5e2c946 (patch).

ALSA: ppc: Fix of-node refcount unbalance

We forgot to unreference the node when aborting from the loop of
for_each_child_of_node() in snd_pmac_tumbler_init().  This leads to
unbalanced node refcount.  Fix it by adding the missing of_node_put()
call.

Signed-off-by: Takashi Iwai <[email protected]>

There is one line of Linux source code added/deleted in this change. Code changes to Linux kernel are as follows.

 sound/ppc/tumbler.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/sound/ppc/tumbler.c b/sound/ppc/tumbler.c
index 6d7ffff..78e5798 100644
--- a/sound/ppc/tumbler.c
+++ b/sound/ppc/tumbler.c
@@ -1371,6 +1371,7 @@ int snd_pmac_tumbler_init(struct snd_pmac *chip)
                mix->anded_reset = 1;
            if (of_get_property(np, "layout-id", NULL))
                mix->reset_on_sleep = 0;
+           of_node_put(np);
            break;
        }
    }

Leave a Reply

Your email address will not be published. Required fields are marked *