diff mbox series

[2/3] ALSA: aoa: Fix of-node refcount unbalance

Message ID 20190219153124.12595-3-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
We forgot to unreference a node obtained via of_find_node_by_name()
after its usage.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
---

Only compile-tested.  Please review carefully.  Thanks!

 sound/aoa/core/gpio-feature.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Johannes Berg Feb. 19, 2019, 3:50 p.m. UTC | #1
On Tue, 2019-02-19 at 16:31 +0100, Takashi Iwai wrote:
> We forgot to unreference a node obtained via of_find_node_by_name()
> after its usage.

How did you find this now?! Though I guess something like smatch could
find it, or even coccinelle?

> Only compile-tested.  Please review carefully.  Thanks!

Yes, looks right

Reviewed-by: Johannes Berg <johannes@sipsolutions.net>

I still have, but no longer run, the machine that uses this driver ...
anyone need a Powermac G5 quad? ;-)

johannes
Takashi Iwai Feb. 19, 2019, 3:57 p.m. UTC | #2
On Tue, 19 Feb 2019 16:50:00 +0100,
Johannes Berg wrote:
> 
> On Tue, 2019-02-19 at 16:31 +0100, Takashi Iwai wrote:
> > We forgot to unreference a node obtained via of_find_node_by_name()
> > after its usage.
> 
> How did you find this now?! Though I guess something like smatch could
> find it, or even coccinelle?

I'm old-fashioned, just did manual reviews casually after the
discussion about the recent regression regarding OF node refcount in
an ASoC driver :)

A coccinelle or such would be smarter, yeah :)

> > Only compile-tested.  Please review carefully.  Thanks!
> 
> Yes, looks right
> 
> Reviewed-by: Johannes Berg <johannes@sipsolutions.net>
> 
> I still have, but no longer run, the machine that uses this driver ...
> anyone need a Powermac G5 quad? ;-)

Let's seek for museums :)


thanks,

Takashi
diff mbox series

Patch

diff --git a/sound/aoa/core/gpio-feature.c b/sound/aoa/core/gpio-feature.c
index 65557421fe0b..c3ff721e4660 100644
--- a/sound/aoa/core/gpio-feature.c
+++ b/sound/aoa/core/gpio-feature.c
@@ -82,6 +82,7 @@  static struct device_node *get_gpio(char *name,
 			if (altname && (strcmp(audio_gpio, altname) == 0))
 				break;
 		}
+		of_node_put(gpio);
 		/* still not found, assume not there */
 		if (!np)
 			return NULL;