浏览代码

gpio: dwapb: add missing fwnode_handle_put() in dwapb_gpio_get_pdata()

fwnode_handle_put() should be used when terminating
device_for_each_child_node() iteration with break or
return to prevent stale device node references from
being left behind.

Generated by Coccinelle.

Fixes: 4ba8cfa79f44 ("gpio: dwapb: convert device node to fwnode")
Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Wei Yongjun 9 年之前
父节点
当前提交
bfab7c8ff8
共有 1 个文件被更改,包括 1 次插入0 次删除
  1. 1 0
      drivers/gpio/gpio-dwapb.c

+ 1 - 0
drivers/gpio/gpio-dwapb.c

@@ -486,6 +486,7 @@ dwapb_gpio_get_pdata(struct device *dev)
 		    pp->idx >= DWAPB_MAX_PORTS) {
 			dev_err(dev,
 				"missing/invalid port index for port%d\n", i);
+			fwnode_handle_put(fwnode);
 			return ERR_PTR(-EINVAL);
 		}