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>
This commit is contained in:
Yang Yingliang 2021-12-21 19:38:25 +08:00 committed by Bartosz Golaszewski
parent 572006bce3
commit a2d05fb734

View File

@ -444,8 +444,10 @@ static int gpio_sim_probe(struct platform_device *pdev)
device_for_each_child_node(dev, swnode) { device_for_each_child_node(dev, swnode) {
ret = gpio_sim_add_bank(swnode, dev); ret = gpio_sim_add_bank(swnode, dev);
if (ret) if (ret) {
fwnode_handle_put(swnode);
return ret; return ret;
}
} }
return 0; return 0;