1 From foo@baz Sat Sep 29 04:30:43 PDT 2018
2 From: Nicholas Mc Guire <hofrat@osadl.org>
3 Date: Fri, 29 Jun 2018 19:07:42 +0200
4 Subject: ALSA: snd-aoa: add of_node_put() in error path
6 From: Nicholas Mc Guire <hofrat@osadl.org>
8 [ Upstream commit 222bce5eb88d1af656419db04bcd84b2419fb900 ]
10 Both calls to of_find_node_by_name() and of_get_next_child() return a
11 node pointer with refcount incremented thus it must be explicidly
12 decremented here after the last usage. As we are assured to have a
13 refcounted np either from the initial
14 of_find_node_by_name(NULL, name); or from the of_get_next_child(gpio, np)
15 in the while loop if we reached the error code path below, an
16 x of_node_put(np) is needed.
18 Signed-off-by: Nicholas Mc Guire <hofrat@osadl.org>
19 Fixes: commit f3d9478b2ce4 ("[ALSA] snd-aoa: add snd-aoa")
20 Signed-off-by: Takashi Iwai <tiwai@suse.de>
21 Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
22 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
24 sound/aoa/core/gpio-feature.c | 4 +++-
25 1 file changed, 3 insertions(+), 1 deletion(-)
27 --- a/sound/aoa/core/gpio-feature.c
28 +++ b/sound/aoa/core/gpio-feature.c
29 @@ -88,8 +88,10 @@ static struct device_node *get_gpio(char
32 reg = of_get_property(np, "reg", NULL);