Thread (2 messages) flat view 2 messages, 2 authors, 2026-04-03
STALE160d

[PATCH v2 1/2] ALSA: aoa/onyx: Fix OF node leak on probe failure

From: <hidden>
Date: 2026-04-03 02:31:23
Also in: linux-sound
Subsystem: aoa (apple onboard audio) alsa driver, sound, the rest · Maintainers: Johannes Berg, Jaroslav Kysela, Takashi Iwai, Linus Torvalds

From: wangdicheng <redacted>

Add missing of_node_put() in the error path.

Signed-off-by: wangdicheng <redacted>
---

v1->v2:
onyx_read_register()--->goto fail--->kfree
aoa_codec_register()--->goto fail_put--->of_node_put + kfree

 sound/aoa/codecs/onyx.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/sound/aoa/codecs/onyx.c b/sound/aoa/codecs/onyx.c
index 04961c456d2c..da0eebf5dfbc 100644
--- a/sound/aoa/codecs/onyx.c
+++ b/sound/aoa/codecs/onyx.c
@@ -980,10 +980,12 @@ static int onyx_i2c_probe(struct i2c_client *client)
 	onyx->codec.node = of_node_get(node);
 
 	if (aoa_codec_register(&onyx->codec)) {
-		goto fail;
+		goto fail_put;
 	}
 	printk(KERN_DEBUG PFX "created and attached onyx instance\n");
 	return 0;
+ fail_put:
+	of_node_put(onyx->codec.node);
  fail:
 	kfree(onyx);
 	return -ENODEV;
-- 
2.25.1

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help