This change is needed to properly lock I2C bus driver, which serves DDC.

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

Signed-off-by: Vladimir Zapolskiy <[email protected]>
---
 drivers/gpu/drm/tilcdc/tilcdc_tfp410.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/tilcdc/tilcdc_tfp410.c 
b/drivers/gpu/drm/tilcdc/tilcdc_tfp410.c
index 354c47c..4dc78c7 100644
--- a/drivers/gpu/drm/tilcdc/tilcdc_tfp410.c
+++ b/drivers/gpu/drm/tilcdc/tilcdc_tfp410.c
@@ -348,15 +348,13 @@ static int tfp410_probe(struct platform_device *pdev)
                goto fail;
        }
 
-       tfp410_mod->i2c = of_find_i2c_adapter_by_node(i2c_node);
+       tfp410_mod->i2c = of_get_i2c_adapter_by_node(i2c_node);
+       of_node_put(i2c_node);
        if (!tfp410_mod->i2c) {
                dev_err(&pdev->dev, "could not get i2c\n");
-               of_node_put(i2c_node);
                goto fail;
        }
 
-       of_node_put(i2c_node);
-
        tfp410_mod->gpio = of_get_named_gpio_flags(node, "powerdn-gpio",
                        0, NULL);
        if (IS_ERR_VALUE(tfp410_mod->gpio)) {
-- 
2.1.4

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

Reply via email to