lkml.org 
[lkml]   [2021]   [Mar]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH -next] clocksource/drivers/ingenic_ost: Fix return value check in ingenic_ost_probe()
    Date
    From: Wei Yongjun <weiyongjun1@huawei.com>

    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>
    ---
    drivers/clocksource/ingenic-ost.c | 4 ++--
    1 file changed, 2 insertions(+), 2 deletions(-)

    diff --git a/drivers/clocksource/ingenic-ost.c b/drivers/clocksource/ingenic-ost.c
    index 029efc2731b4..6af2470136bd 100644
    --- a/drivers/clocksource/ingenic-ost.c
    +++ b/drivers/clocksource/ingenic-ost.c
    @@ -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");
    \
     
     \ /
      Last update: 2021-03-08 13:22    [W:3.723 / U:0.172 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site