diff mbox series

gpio/rockchip: Add missing of_node_put() in rockchip_gpiolib_register()

Message ID 20221126083506.5952-1-shangxiaojing@huawei.com
State New
Headers show
Series gpio/rockchip: Add missing of_node_put() in rockchip_gpiolib_register() | expand

Commit Message

shangxiaojing Nov. 26, 2022, 8:35 a.m. UTC
rockchip_gpiolib_register() get the device_node by of_get_parent() with
refcount incremented. Add of_node_put() on it before exitting
rockchip_gpiolib_register(). So as rockchip_gpio_probe().

Fixes: 936ee2675eee ("gpio/rockchip: add driver for rockchip gpio")
Signed-off-by: Shang XiaoJing <shangxiaojing@huawei.com>
---
 drivers/gpio/gpio-rockchip.c | 2 ++
 1 file changed, 2 insertions(+)
diff mbox series

Patch

diff --git a/drivers/gpio/gpio-rockchip.c b/drivers/gpio/gpio-rockchip.c
index 870910bb9dd3..3c1e303aaca8 100644
--- a/drivers/gpio/gpio-rockchip.c
+++ b/drivers/gpio/gpio-rockchip.c
@@ -610,6 +610,7 @@  static int rockchip_gpiolib_register(struct rockchip_pin_bank *bank)
 			return -ENODATA;
 
 		pctldev = of_pinctrl_get(pctlnp);
+		of_node_put(pctlnp);
 		if (!pctldev)
 			return -ENODEV;
 
@@ -712,6 +713,7 @@  static int rockchip_gpio_probe(struct platform_device *pdev)
 		return -ENODEV;
 
 	pctldev = of_pinctrl_get(pctlnp);
+	of_node_put(pctlnp);
 	if (!pctldev)
 		return -EPROBE_DEFER;