This change is needed to properly lock I2C parent bus driver.

Prior to this change i2c_put_adapter() is misused, which may lead
to an overflow over zero of I2C bus driver user counter.

By the way added a missing of_node_put() to eliminate memory leak,
if OF_DYNAMIC is enabled.

Signed-off-by: Vladimir Zapolskiy <vladimir_zapols...@mentor.com>
Cc: Doug Anderson <diand...@chromium.org>
---
Changes from v1 to v2:
* none, the same change as v1 10/10

 drivers/i2c/muxes/i2c-arb-gpio-challenge.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/i2c/muxes/i2c-arb-gpio-challenge.c 
b/drivers/i2c/muxes/i2c-arb-gpio-challenge.c
index 5cf1b60..402e3a6 100644
--- a/drivers/i2c/muxes/i2c-arb-gpio-challenge.c
+++ b/drivers/i2c/muxes/i2c-arb-gpio-challenge.c
@@ -196,7 +196,8 @@ static int i2c_arbitrator_probe(struct platform_device 
*pdev)
                dev_err(dev, "Cannot parse i2c-parent\n");
                return -EINVAL;
        }
-       arb->parent = of_find_i2c_adapter_by_node(parent_np);
+       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;
-- 
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-i2c" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to