]> git.baikalelectronics.ru Git - kernel.git/commitdiff
i2c: mux-gpmux: Add of_node_put() when breaking out of loop
authorLiang He <windhl@126.com>
Fri, 22 Jul 2022 01:24:01 +0000 (09:24 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 25 Aug 2022 09:17:47 +0000 (11:17 +0200)
[ Upstream commit 5d2ccb853ecb774fb9fbb18646b0b9095045ea0a ]

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: 084a8653c40a ("i2c: i2c-mux-gpmux: new driver")
Signed-off-by: Liang He <windhl@126.com>
Acked-by: Peter Rosin <peda@axentia.se>
Signed-off-by: Wolfram Sang <wsa@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/i2c/muxes/i2c-mux-gpmux.c

index f830535cff1223b1b4299d096c5ae37fd9b6f049..480ec74e6134de6f79ad1da9ebca43ce57c7f73b 100644 (file)
@@ -138,6 +138,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);