diff options
author | Yang Yingliang <yangyingliang@huawei.com> | 2021-12-21 19:38:25 +0800 |
---|---|---|
committer | Bartosz Golaszewski <brgl@bgdev.pl> | 2021-12-21 16:19:14 +0100 |
commit | a2d05fb73493ca89b36c7d2c3ffc76effbfcd763 (patch) | |
tree | 5170b6c499e42e17046cdd391b67250fa1e559b1 /drivers/gpio/gpio-sim.c | |
parent | 572006bce34caee37af84a8946895a495c56624a (diff) | |
download | linux-a2d05fb73493ca89b36c7d2c3ffc76effbfcd763.tar.bz2 |
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/gpio-sim.c')
-rw-r--r-- | drivers/gpio/gpio-sim.c | 4 |
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; |