[PATCH] i2c: of-prober: Fix device node reference leak in i2c_of_probe_simple_enable()
From: Wentao Liang
Date: Wed Sep 16 2026 - 12:30:45 EST
of_get_compatible_child() returns the child node with an incremented
reference which the caller must drop with of_node_put(). The error
paths release it via the out_put_node label, but the success path
returns without doing so, leaking the node reference.
Release the node before returning success.
Fixes: 897261149d25 ("i2c: of-prober: Add simple helpers for regulator support")
Cc: stable@xxxxxxxxxxxxxxx
Signed-off-by: Wentao Liang <vulab@xxxxxxxxxxx>
---
drivers/i2c/i2c-core-of-prober.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/i2c/i2c-core-of-prober.c b/drivers/i2c/i2c-core-of-prober.c
index 6a82b03809d4..603de487ee2d 100644
--- a/drivers/i2c/i2c-core-of-prober.c
+++ b/drivers/i2c/i2c-core-of-prober.c
@@ -354,6 +354,7 @@ int i2c_of_probe_simple_enable(struct device *dev, struct device_node *bus_node,
if (ret)
goto out_disable_regulator;
+ of_node_put(node);
return 0;
out_disable_regulator:
--
2.34.1