Skip to contentSkip to conversation

i2c: i2c-mux-gpmux: Add of_node_put() when breaking out of loop

PATCH In review Liang He 2 participants 2 messages Jul 22, 2022 – Jul 25, 2022

Subsystems (2)
lore
Share & tools
lore

Liang He

author
#0 lore raw

PATCH v2 1/1 i2c: i2c-mux-gpmux: Add of_node_put() when breaking out of loop

In i2c_mux_probe(), we should call of_node_put() when breaking out of for_each_child_of_node() which will automatically increase and decrease the refcount.

Fixes ac8498f0ce53 ("i2c: i2c-mux-gpmux: new driver")

---
changelog:

v2: make a correct patch pointed out by Peter
v1: https://lore.kernel.org/all/[email protected]/

 drivers/i2c/muxes/i2c-mux-gpmux.c | 1 +
 1 file changed, 1 insertion(+)
drivers/i2c/muxes/i2c-mux-gpmux.c +1 -0
index d3acd8d66c32..33024acaac02 100644
@@ -134,6 +134,7 @@ static int i2c_mux_probe(struct platform_device *pdev)
 	return 0;
 
 err_children:
+	of_node_put(child);
 	i2c_mux_del_adapters(muxc);
 err_parent:
 	i2c_put_adapter(parent);
Signature · 1 line
2.25.1
Acked-by on v2 1/1
#1 lore raw
Quoted 6 lines · Liang He

In i2c_mux_probe(), we should call of_node_put() when breaking out of for_each_child_of_node() which will automatically increase and decrease the refcount.

Fixes ac8498f0ce53 ("i2c: i2c-mux-gpmux: new driver")

Cheers,
Peter

Quoted 21 lines

---
changelog:

v2: make a correct patch pointed out by Peter
v1: https://lore.kernel.org/all/[email protected]/

 drivers/i2c/muxes/i2c-mux-gpmux.c | 1 +
 1 file changed, 1 insertion(+)
drivers/i2c/muxes/i2c-mux-gpmux.c +1 -0
index d3acd8d66c32..33024acaac02 100644
@@ -134,6 +134,7 @@ static int i2c_mux_probe(struct platform_device *pdev)
 	return 0;
 
 err_children:
+	of_node_put(child);
 	i2c_mux_del_adapters(muxc);
 err_parent:
 	i2c_put_adapter(parent);