提交 662786a5 编写于 作者: A Alexey Khoroshilov 提交者: Wolfram Sang

i2c: axxia: disable clks in case of failure in probe

axxia_i2c_probe() does not disable clock in case of failure
in i2c_add_adapter(). Also it ignores returned value from
clk_prepare_enable().

Found by Linux Driver Verification project (linuxtesting.org).
Signed-off-by: NAlexey Khoroshilov <khoroshilov@ispras.ru>
Signed-off-by: NWolfram Sang <wsa@the-dreams.de>
上级 70121f7f
...@@ -545,7 +545,11 @@ static int axxia_i2c_probe(struct platform_device *pdev) ...@@ -545,7 +545,11 @@ static int axxia_i2c_probe(struct platform_device *pdev)
return ret; return ret;
} }
clk_prepare_enable(idev->i2c_clk); ret = clk_prepare_enable(idev->i2c_clk);
if (ret) {
dev_err(&pdev->dev, "failed to enable clock\n");
return ret;
}
i2c_set_adapdata(&idev->adapter, idev); i2c_set_adapdata(&idev->adapter, idev);
strlcpy(idev->adapter.name, pdev->name, sizeof(idev->adapter.name)); strlcpy(idev->adapter.name, pdev->name, sizeof(idev->adapter.name));
...@@ -558,7 +562,13 @@ static int axxia_i2c_probe(struct platform_device *pdev) ...@@ -558,7 +562,13 @@ static int axxia_i2c_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, idev); platform_set_drvdata(pdev, idev);
return i2c_add_adapter(&idev->adapter); ret = i2c_add_adapter(&idev->adapter);
if (ret) {
clk_disable_unprepare(idev->i2c_clk);
return ret;
}
return 0;
} }
static int axxia_i2c_remove(struct platform_device *pdev) static int axxia_i2c_remove(struct platform_device *pdev)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册