Skip to contentSkip to conversation

ALSA: aoa/onyx: Fix OF node leak on probe failure

PATCH Applied [email protected] 2 participants 2 messages Apr 2

Subsystems (2)

v1 of 2 Applied Latest is v2 →

lore
Share & tools
lore
#0 lore raw

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

From: wangdicheng <[email protected]>

Add missing of_node_put() in the error path.

---
 sound/aoa/codecs/onyx.c | 1 +
 1 file changed, 1 insertion(+)
sound/aoa/codecs/onyx.c +1 -0
index 04961c456d2c..fea12d3a06a9 100644
@@ -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;
 }
Signature · 1 line
2.25.1
#1 lore raw
Quoted 15 lines · On Thu, 02 Apr 2026 04:35:41 +0200, [email protected] wrote:

From: wangdicheng <[email protected]>

Add missing of_node_put() in the error path.

---
 sound/aoa/codecs/onyx.c | 1 +
 1 file changed, 1 insertion(+)
sound/aoa/codecs/onyx.c +0 -0
index 04961c456d2c..fea12d3a06a9 100644

sound/aoa/codecs/onyx.c static int onyx_i2c_probe(struct i2c_client *client) · line 990

Quoted 6 lines
sound/aoa/codecs/onyx.c +1 -0
@@ -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