提交 b683fb85 编写于 作者: W Wei Yongjun 提交者: Zheng Zengkai

clocksource/drivers/ingenic_ost: Fix return value check in ingenic_ost_probe()

stable inclusion
from stable-5.10.37
commit 1de36911689c192aa1c20682102ceb956b5372c0
bugzilla: 51868
CVE: NA

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

[ Upstream commit 2a65f7e2 ]

In case of error, the function device_node_to_regmap() returns
ERR_PTR() and never returns NULL. The NULL test in the return
value check should be replaced with IS_ERR().

Fixes: ca7b72b5 ("clocksource: Add driver for the Ingenic JZ47xx OST")
Reported-by: NHulk Robot <hulkci@huawei.com>
Signed-off-by: NWei Yongjun <weiyongjun1@huawei.com>
Signed-off-by: NDaniel Lezcano <daniel.lezcano@linaro.org>
Link: https://lore.kernel.org/r/20210308123031.2285083-1-weiyongjun1@huawei.comSigned-off-by: NSasha Levin <sashal@kernel.org>
Signed-off-by: NChen Jun <chenjun102@huawei.com>
Acked-by: NWeilong Chen <chenweilong@huawei.com>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
上级 85e04a4f
...@@ -88,9 +88,9 @@ static int __init ingenic_ost_probe(struct platform_device *pdev) ...@@ -88,9 +88,9 @@ static int __init ingenic_ost_probe(struct platform_device *pdev)
return PTR_ERR(ost->regs); return PTR_ERR(ost->regs);
map = device_node_to_regmap(dev->parent->of_node); map = device_node_to_regmap(dev->parent->of_node);
if (!map) { if (IS_ERR(map)) {
dev_err(dev, "regmap not found"); dev_err(dev, "regmap not found");
return -EINVAL; return PTR_ERR(map);
} }
ost->clk = devm_clk_get(dev, "ost"); ost->clk = devm_clk_get(dev, "ost");
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册