Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Yang Yingliang and committed by
Bartosz Golaszewski
a2d05fb7 572006bc

+3 -1
+3 -1
drivers/gpio/gpio-sim.c
··· 444 444 445 445 device_for_each_child_node(dev, swnode) { 446 446 ret = gpio_sim_add_bank(swnode, dev); 447 - if (ret) 447 + if (ret) { 448 + fwnode_handle_put(swnode); 448 449 return ret; 450 + } 449 451 } 450 452 451 453 return 0;