提交 044ea131 编写于 作者: U Uwe Kleine-König 提交者: Zheng Zengkai

hwmon: (ltc2947) Properly handle errors when looking for the external clock

stable inclusion
from stable-5.10.74
commit 3d68c7b0ab5b5b9fd7a2a8b13114ac0336e23a30
bugzilla: 182986 https://gitee.com/openeuler/kernel/issues/I4I3MG

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=3d68c7b0ab5b5b9fd7a2a8b13114ac0336e23a30

--------------------------------

[ Upstream commit 6f7d7046 ]

The return value of devm_clk_get should in general be propagated to
upper layer. In this case the clk is optional, use the appropriate
wrapper instead of interpreting all errors as "The optional clk is not
available".
Signed-off-by: NUwe Kleine-König <u.kleine-koenig@pengutronix.de>
Link: https://lore.kernel.org/r/20210923201113.398932-1-u.kleine-koenig@pengutronix.deSigned-off-by: NGuenter Roeck <linux@roeck-us.net>
Signed-off-by: NSasha Levin <sashal@kernel.org>
Signed-off-by: NChen Jun <chenjun102@huawei.com>
Reviewed-by: NWeilong Chen <chenweilong@huawei.com>
Acked-by: NWeilong Chen <chenweilong@huawei.com>
Signed-off-by: NChen Jun <chenjun102@huawei.com>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
上级 0a4dff12
......@@ -989,8 +989,12 @@ static int ltc2947_setup(struct ltc2947_data *st)
return ret;
/* check external clock presence */
extclk = devm_clk_get(st->dev, NULL);
if (!IS_ERR(extclk)) {
extclk = devm_clk_get_optional(st->dev, NULL);
if (IS_ERR(extclk))
return dev_err_probe(st->dev, PTR_ERR(extclk),
"Failed to get external clock\n");
if (extclk) {
unsigned long rate_hz;
u8 pre = 0, div, tbctl;
u64 aux;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册