i2c: muxes: fix leaked i2c adapter device node references
authorVladimir Zapolskiy <vz@mleia.com>
Wed, 26 Aug 2015 20:59:33 +0000 (23:59 +0300)
committerWolfram Sang <wsa@the-dreams.de>
Mon, 31 Aug 2015 20:40:34 +0000 (22:40 +0200)
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>
drivers/i2c/muxes/i2c-arb-gpio-challenge.c
drivers/i2c/muxes/i2c-mux-gpio.c
drivers/i2c/muxes/i2c-mux-pinctrl.c
drivers/i2c/muxes/i2c-mux-reg.c

index 71aac09..402e3a6 100644 (file)
@@ -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;
index 70db992..b8e11c1 100644 (file)
@@ -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;
 
index b48378c..b5a982b 100644 (file)
@@ -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;
index 86d41d3..57ec57e 100644 (file)
@@ -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;