Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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

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: ca7b72b5a5f2 ("clocksource: Add driver for the Ingenic JZ47xx OST")
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Link: https://lore.kernel.org/r/20210308123031.2285083-1-weiyongjun1@huawei.com

authored by

Wei Yongjun and committed by
Daniel Lezcano
2a65f7e2 ac4daf73

+2 -2
+2 -2
drivers/clocksource/ingenic-ost.c
··· 88 88 return PTR_ERR(ost->regs); 89 89 90 90 map = device_node_to_regmap(dev->parent->of_node); 91 - if (!map) { 91 + if (IS_ERR(map)) { 92 92 dev_err(dev, "regmap not found"); 93 - return -EINVAL; 93 + return PTR_ERR(map); 94 94 } 95 95 96 96 ost->clk = devm_clk_get(dev, "ost");