]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
clocksource/drivers/ingenic_ost: Fix return value check in ingenic_ost_probe()
authorWei Yongjun <weiyongjun1@huawei.com>
Mon, 8 Mar 2021 12:30:31 +0000 (12:30 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 14 May 2021 08:49:45 +0000 (10:49 +0200)
[ Upstream commit 2a65f7e2772613debd03fa2492e76a635aa04545 ]

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
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/clocksource/ingenic-ost.c

index 029efc2731b49f35b89f3b3c07011a2152f8d40b..6af2470136bd28465ccc808c86c3c45d4158d10e 100644 (file)
@@ -88,9 +88,9 @@ static int __init ingenic_ost_probe(struct platform_device *pdev)
                return PTR_ERR(ost->regs);
 
        map = device_node_to_regmap(dev->parent->of_node);
-       if (!map) {
+       if (IS_ERR(map)) {
                dev_err(dev, "regmap not found");
-               return -EINVAL;
+               return PTR_ERR(map);
        }
 
        ost->clk = devm_clk_get(dev, "ost");