public inbox for linux-sound@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] ALSA: aoa/onyx: Fix OF node leak on probe failure
@ 2026-04-02  2:35 wangdich9700
  2026-04-02 10:43 ` Takashi Iwai
  0 siblings, 1 reply; 2+ messages in thread
From: wangdich9700 @ 2026-04-02  2:35 UTC (permalink / raw)
  To: johannes, perex, tiwai, wangdich9700; +Cc: linux-sound, wangdicheng

From: wangdicheng <wangdicheng@kylinos.cn>

Add missing of_node_put() in the error path.

Signed-off-by: wangdicheng <wangdicheng@kylinos.cn>
---
 sound/aoa/codecs/onyx.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/sound/aoa/codecs/onyx.c b/sound/aoa/codecs/onyx.c
index 04961c456d2c..fea12d3a06a9 100644
--- a/sound/aoa/codecs/onyx.c
+++ b/sound/aoa/codecs/onyx.c
@@ -985,6 +985,7 @@ static int onyx_i2c_probe(struct i2c_client *client)
 	printk(KERN_DEBUG PFX "created and attached onyx instance\n");
 	return 0;
  fail:
+	of_node_put(onyx->codec.node);
 	kfree(onyx);
 	return -ENODEV;
 }
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH 1/2] ALSA: aoa/onyx: Fix OF node leak on probe failure
  2026-04-02  2:35 [PATCH 1/2] ALSA: aoa/onyx: Fix OF node leak on probe failure wangdich9700
@ 2026-04-02 10:43 ` Takashi Iwai
  0 siblings, 0 replies; 2+ messages in thread
From: Takashi Iwai @ 2026-04-02 10:43 UTC (permalink / raw)
  To: wangdich9700; +Cc: johannes, perex, tiwai, linux-sound, wangdicheng

On Thu, 02 Apr 2026 04:35:41 +0200,
wangdich9700@163.com wrote:
> 
> From: wangdicheng <wangdicheng@kylinos.cn>
> 
> Add missing of_node_put() in the error path.
> 
> Signed-off-by: wangdicheng <wangdicheng@kylinos.cn>
> ---
>  sound/aoa/codecs/onyx.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/sound/aoa/codecs/onyx.c b/sound/aoa/codecs/onyx.c
> index 04961c456d2c..fea12d3a06a9 100644
> --- a/sound/aoa/codecs/onyx.c
> +++ b/sound/aoa/codecs/onyx.c
> @@ -985,6 +985,7 @@ static int onyx_i2c_probe(struct i2c_client *client)
>  	printk(KERN_DEBUG PFX "created and attached onyx instance\n");
>  	return 0;
>   fail:
> +	of_node_put(onyx->codec.node);
>  	kfree(onyx);
>  	return -ENODEV;

This error path is used commonly for the code path before
of_node_get(), hence you can't put of_node_put() unconditionally.

You'll need another goto label for of_node_put() and the error path
from aoa_codec_register() should jump to it.


thanks,

Takashi

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-04-02 10:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-02  2:35 [PATCH 1/2] ALSA: aoa/onyx: Fix OF node leak on probe failure wangdich9700
2026-04-02 10:43 ` Takashi Iwai

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox