提交 bbeb6b6c 编写于 作者: B Baolin Wang 提交者: Wolfram Sang

i2c: sprd: Validate the return value of clock initialization

The 'enable' clock of I2C master is required, we should return an error
if failed to get the 'enable' clock, to make sure the I2C driver can be
defer probe if the clock resource is not ready.
Signed-off-by: NBaolin Wang <baolin.wang@linaro.org>
Signed-off-by: NWolfram Sang <wsa@the-dreams.de>
上级 3c2588fa
......@@ -466,9 +466,9 @@ static int sprd_i2c_clk_init(struct sprd_i2c *i2c_dev)
i2c_dev->clk = devm_clk_get(i2c_dev->dev, "enable");
if (IS_ERR(i2c_dev->clk)) {
dev_warn(i2c_dev->dev, "i2c%d can't get the enable clock\n",
i2c_dev->adap.nr);
i2c_dev->clk = NULL;
dev_err(i2c_dev->dev, "i2c%d can't get the enable clock\n",
i2c_dev->adap.nr);
return PTR_ERR(i2c_dev->clk);
}
return 0;
......@@ -519,7 +519,10 @@ static int sprd_i2c_probe(struct platform_device *pdev)
if (i2c_dev->bus_freq != 100000 && i2c_dev->bus_freq != 400000)
return -EINVAL;
sprd_i2c_clk_init(i2c_dev);
ret = sprd_i2c_clk_init(i2c_dev);
if (ret)
return ret;
platform_set_drvdata(pdev, i2c_dev);
ret = clk_prepare_enable(i2c_dev->clk);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册