summaryrefslogtreecommitdiff
path: root/drivers/gpio
diff options
context:
space:
mode:
authorYang Yingliang <yangyingliang@huawei.com>2021-12-21 14:38:25 +0300
committerBartosz Golaszewski <brgl@bgdev.pl>2021-12-21 18:19:14 +0300
commita2d05fb73493ca89b36c7d2c3ffc76effbfcd763 (patch)
tree5170b6c499e42e17046cdd391b67250fa1e559b1 /drivers/gpio
parent572006bce34caee37af84a8946895a495c56624a (diff)
downloadlinux-a2d05fb73493ca89b36c7d2c3ffc76effbfcd763.tar.xz
gpio: sim: add missing fwnode_handle_put() in gpio_sim_probe()
Calling fwnode_handle_put() when break out of device_for_each_child_node(), or the device node reference will be leakd. Fixes: 83960fcf4818 ("gpio: sim: new testing module") Reported-by: Hulk Robot <hulkci@huawei.com> Signed-off-by: Yang Yingliang <yangyingliang@huawei.com> Signed-off-by: Bartosz Golaszewski <brgl@bgdev.pl>
Diffstat (limited to 'drivers/gpio')
-rw-r--r--drivers/gpio/gpio-sim.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/gpio/gpio-sim.c b/drivers/gpio/gpio-sim.c
index bef00dcc4dc8..838bbfed11d3 100644
--- a/drivers/gpio/gpio-sim.c
+++ b/drivers/gpio/gpio-sim.c
@@ -444,8 +444,10 @@ static int gpio_sim_probe(struct platform_device *pdev)
device_for_each_child_node(dev, swnode) {
ret = gpio_sim_add_bank(swnode, dev);
- if (ret)
+ if (ret) {
+ fwnode_handle_put(swnode);
return ret;
+ }
}
return 0;