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: Vladimir Zapolskiy <vz@mleia.com>
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
This commit is contained in:
Vladimir Zapolskiy 2015-08-26 23:59:33 +03:00 committed by Wolfram Sang
parent 3fffd12839
commit bdbf4a29ee
4 changed files with 4 additions and 0 deletions

View File

@ -197,6 +197,7 @@ static int i2c_arbitrator_probe(struct platform_device *pdev)
return -EINVAL; return -EINVAL;
} }
arb->parent = of_get_i2c_adapter_by_node(parent_np); arb->parent = of_get_i2c_adapter_by_node(parent_np);
of_node_put(parent_np);
if (!arb->parent) { if (!arb->parent) {
dev_err(dev, "Cannot find parent bus\n"); dev_err(dev, "Cannot find parent bus\n");
return -EPROBE_DEFER; return -EPROBE_DEFER;

View File

@ -76,6 +76,7 @@ static int i2c_mux_gpio_probe_dt(struct gpiomux *mux,
return -ENODEV; return -ENODEV;
} }
adapter = of_find_i2c_adapter_by_node(adapter_np); adapter = of_find_i2c_adapter_by_node(adapter_np);
of_node_put(adapter_np);
if (!adapter) if (!adapter)
return -EPROBE_DEFER; return -EPROBE_DEFER;

View File

@ -111,6 +111,7 @@ static int i2c_mux_pinctrl_parse_dt(struct i2c_mux_pinctrl *mux,
return -ENODEV; return -ENODEV;
} }
adapter = of_find_i2c_adapter_by_node(adapter_np); adapter = of_find_i2c_adapter_by_node(adapter_np);
of_node_put(adapter_np);
if (!adapter) { if (!adapter) {
dev_err(mux->dev, "Cannot find parent bus\n"); dev_err(mux->dev, "Cannot find parent bus\n");
return -EPROBE_DEFER; return -EPROBE_DEFER;

View File

@ -106,6 +106,7 @@ static int i2c_mux_reg_probe_dt(struct regmux *mux,
return -ENODEV; return -ENODEV;
} }
adapter = of_find_i2c_adapter_by_node(adapter_np); adapter = of_find_i2c_adapter_by_node(adapter_np);
of_node_put(adapter_np);
if (!adapter) if (!adapter)
return -EPROBE_DEFER; return -EPROBE_DEFER;