提交 bdbf4a29 编写于 作者: V Vladimir Zapolskiy 提交者: Wolfram Sang

i2c: muxes: fix leaked i2c adapter device node references

Every call of of_parse_phandle() increments user count of found device
node, if OF_DYNAMIC is enabled.

The change fixes all similar addressed cases in drivers/i2c.
Signed-off-by: NVladimir Zapolskiy <vz@mleia.com>
Signed-off-by: NWolfram Sang <wsa@the-dreams.de>
上级 3fffd128
......@@ -197,6 +197,7 @@ static int i2c_arbitrator_probe(struct platform_device *pdev)
return -EINVAL;
}
arb->parent = of_get_i2c_adapter_by_node(parent_np);
of_node_put(parent_np);
if (!arb->parent) {
dev_err(dev, "Cannot find parent bus\n");
return -EPROBE_DEFER;
......
......@@ -76,6 +76,7 @@ static int i2c_mux_gpio_probe_dt(struct gpiomux *mux,
return -ENODEV;
}
adapter = of_find_i2c_adapter_by_node(adapter_np);
of_node_put(adapter_np);
if (!adapter)
return -EPROBE_DEFER;
......
......@@ -111,6 +111,7 @@ static int i2c_mux_pinctrl_parse_dt(struct i2c_mux_pinctrl *mux,
return -ENODEV;
}
adapter = of_find_i2c_adapter_by_node(adapter_np);
of_node_put(adapter_np);
if (!adapter) {
dev_err(mux->dev, "Cannot find parent bus\n");
return -EPROBE_DEFER;
......
......@@ -106,6 +106,7 @@ static int i2c_mux_reg_probe_dt(struct regmux *mux,
return -ENODEV;
}
adapter = of_find_i2c_adapter_by_node(adapter_np);
of_node_put(adapter_np);
if (!adapter)
return -EPROBE_DEFER;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册