diff mbox series

leds: netxbig: add missing of_node_put() in netxbig_leds_get_of_pdata()

Message ID 20221029105038.3785011-1-yangyingliang@huawei.com
State New
Headers show
Series leds: netxbig: add missing of_node_put() in netxbig_leds_get_of_pdata() | expand

Commit Message

Yang Yingliang Oct. 29, 2022, 10:50 a.m. UTC
The 'gpio_ext_np' returned by of_parse_phandle() with refcount decremented,
of_node_put() need be called in error path to decrease the refcount.

Fixes: 9af512e81964 ("leds: netxbig: Convert to use GPIO descriptors")
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
---
 drivers/leds/leds-netxbig.c | 1 +
 1 file changed, 1 insertion(+)
diff mbox series

Patch

diff --git a/drivers/leds/leds-netxbig.c b/drivers/leds/leds-netxbig.c
index 77213b79f84d..6692de0af68f 100644
--- a/drivers/leds/leds-netxbig.c
+++ b/drivers/leds/leds-netxbig.c
@@ -440,6 +440,7 @@  static int netxbig_leds_get_of_pdata(struct device *dev,
 	}
 	gpio_ext_pdev = of_find_device_by_node(gpio_ext_np);
 	if (!gpio_ext_pdev) {
+		of_node_put(gpio_ext_np);
 		dev_err(dev, "Failed to find platform device for gpio-ext\n");
 		return -ENODEV;
 	}