Message ID | 20220722012401.1303609-1-windhl@126.com |
---|---|
State | Accepted |
Commit | 6435319c34704994e19b0767f6a4e6f37439867b |
Headers | show |
Series | [v2] i2c: i2c-mux-gpmux: Add of_node_put() when breaking out of loop | expand |
2022-07-22 at 03:24, Liang He wrote: > 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") > Signed-off-by: Liang He <windhl@126.com> Acked-by: Peter Rosin <peda@axentia.se> Cheers, Peter > --- > changelog: > > v2: make a correct patch pointed out by Peter > v1: https://lore.kernel.org/all/20220721081202.1300071-1-windhl@126.com/ > > drivers/i2c/muxes/i2c-mux-gpmux.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/drivers/i2c/muxes/i2c-mux-gpmux.c b/drivers/i2c/muxes/i2c-mux-gpmux.c > index d3acd8d66c32..33024acaac02 100644 > --- a/drivers/i2c/muxes/i2c-mux-gpmux.c > +++ b/drivers/i2c/muxes/i2c-mux-gpmux.c > @@ -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);
diff --git a/drivers/i2c/muxes/i2c-mux-gpmux.c b/drivers/i2c/muxes/i2c-mux-gpmux.c index d3acd8d66c32..33024acaac02 100644 --- a/drivers/i2c/muxes/i2c-mux-gpmux.c +++ b/drivers/i2c/muxes/i2c-mux-gpmux.c @@ -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);
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") Signed-off-by: Liang He <windhl@126.com> --- changelog: v2: make a correct patch pointed out by Peter v1: https://lore.kernel.org/all/20220721081202.1300071-1-windhl@126.com/ drivers/i2c/muxes/i2c-mux-gpmux.c | 1 + 1 file changed, 1 insertion(+)