diff mbox series

[1/3] ALSA: ac97: Fix of-node refcount unbalance

Message ID 20190219153124.12595-2-tiwai@suse.de (mailing list archive)
State New, archived
Headers show
Series ALSA: Fix of-node refcount unbalance | expand

Commit Message

Takashi Iwai Feb. 19, 2019, 3:31 p.m. UTC
ac97_of_get_child_device() take the refcount of the node explicitly
via of_node_get(), but this leads to an unbalance.  The
for_each_child_of_node() loop itself takes the refcount for each
iteration node, hence you don't need to take the extra refcount
again.

Fixes: 2225a3e6af78 ("ALSA: ac97: add codecs devicetree binding")
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---

Only compile-tested.  Please review carefully.  Thanks!

 sound/ac97/bus.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Robert Jarzmik Feb. 19, 2019, 9:08 p.m. UTC | #1
Takashi Iwai <tiwai@suse.de> writes:

> ac97_of_get_child_device() take the refcount of the node explicitly
> via of_node_get(), but this leads to an unbalance.  The
> for_each_child_of_node() loop itself takes the refcount for each
> iteration node, hence you don't need to take the extra refcount
> again.
>
> Fixes: 2225a3e6af78 ("ALSA: ac97: add codecs devicetree binding")
> Signed-off-by: Takashi Iwai <tiwai@suse.de>
> ---
>
> Only compile-tested.  Please review carefully.  Thanks!
Hi Takashi,

Reviewed-by: Robert <robert.jarzmik@free.fr>

Cheers.

--
Robert
diff mbox series

Patch

diff --git a/sound/ac97/bus.c b/sound/ac97/bus.c
index 9f0c480489ef..9cbf6927abe9 100644
--- a/sound/ac97/bus.c
+++ b/sound/ac97/bus.c
@@ -84,7 +84,7 @@  ac97_of_get_child_device(struct ac97_controller *ac97_ctrl, int idx,
 		if ((idx != of_property_read_u32(node, "reg", &reg)) ||
 		    !of_device_is_compatible(node, compat))
 			continue;
-		return of_node_get(node);
+		return node;
 	}
 
 	return NULL;