Skip to content

Commit a1003fd

Browse files
Nicholas Mc Guiregregkh
Nicholas Mc Guire
authored andcommitted
ALSA: snd-aoa: add of_node_put() in error path
[ Upstream commit 222bce5eb88d1af656419db04bcd84b2419fb900 ] Both calls to of_find_node_by_name() and of_get_next_child() return a node pointer with refcount incremented thus it must be explicidly decremented here after the last usage. As we are assured to have a refcounted np either from the initial of_find_node_by_name(NULL, name); or from the of_get_next_child(gpio, np) in the while loop if we reached the error code path below, an x of_node_put(np) is needed. Signed-off-by: Nicholas Mc Guire <[email protected]> Fixes: commit f3d9478 ("[ALSA] snd-aoa: add snd-aoa") Signed-off-by: Takashi Iwai <[email protected]> Signed-off-by: Sasha Levin <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 2d81291 commit a1003fd

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

sound/aoa/core/gpio-feature.c

+3-1
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,10 @@ static struct device_node *get_gpio(char *name,
8888
}
8989

9090
reg = of_get_property(np, "reg", NULL);
91-
if (!reg)
91+
if (!reg) {
92+
of_node_put(np);
9293
return NULL;
94+
}
9395

9496
*gpioptr = *reg;
9597

0 commit comments

Comments
 (0)