[PATCH] i2c: fsi: put OF node on disabled port skip
From: Guangshuo Li
Date: Wed Jul 08 2026 - 07:19:14 EST
fsi_i2c_find_port_of_node() returns a device node with a reference held
by the caller.
The port skip path added for unavailable nodes also handles the case
where no node was found. That case does not hold a reference. However, if
a port node exists but is disabled, fsi_i2c_find_port_of_node() has
returned a referenced node and the skip path leaks that reference.
Drop the node reference before continuing. of_node_put() is safe for a
NULL node, so the no-node case remains unchanged.
Fixes: 58031a26bf2b ("i2c: fsi: Prevent adding adapters for ports without dts nodes")
Signed-off-by: Guangshuo Li <lgs201920130244@xxxxxxxxx>
---
drivers/i2c/busses/i2c-fsi.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/i2c/busses/i2c-fsi.c b/drivers/i2c/busses/i2c-fsi.c
index b2dc5ae1d0e4..9ba6b1c59082 100644
--- a/drivers/i2c/busses/i2c-fsi.c
+++ b/drivers/i2c/busses/i2c-fsi.c
@@ -704,8 +704,10 @@ static int fsi_i2c_probe(struct fsi_device *fsi_dev)
for (port_no = 0; port_no < ports; port_no++) {
np = fsi_i2c_find_port_of_node(dev->of_node, port_no);
- if (!of_device_is_available(np))
+ if (!of_device_is_available(np)) {
+ of_node_put(np);
continue;
+ }
port = kzalloc_obj(*port);
if (!port) {
--
2.43.0