clk: clk-prima2: fix return value check in prima2_clk_init()
authorXu Wang <vulab@iscas.ac.cn>
Mon, 21 Sep 2020 03:45:22 +0000 (03:45 +0000)
committerStephen Boyd <sboyd@kernel.org>
Wed, 14 Oct 2020 02:54:30 +0000 (19:54 -0700)
In case of error, the function clk_register() returns ERR_PTR()
and never returns NULL. The NULL test in the return value check
should be replaced with IS_ERR().

Signed-off-by: Xu Wang <vulab@iscas.ac.cn>
Link: https://lore.kernel.org/r/20200921034522.9077-1-vulab@iscas.ac.cn
Acked-by: Barry Song <baohua@kernel.org>
Signed-off-by: Stephen Boyd <sboyd@kernel.org>
drivers/clk/sirf/clk-prima2.c

index 45dcbc9e0302442715bd8cfa0be62244b6d374a8..d17b345f4d2dbe1ace006351dfcdeefe1bab2f4e 100644 (file)
@@ -134,7 +134,7 @@ static void __init prima2_clk_init(struct device_node *np)
 
        for (i = pll1; i < maxclk; i++) {
                prima2_clks[i] = clk_register(NULL, prima2_clk_hw_array[i]);
-               BUG_ON(!prima2_clks[i]);
+               BUG_ON(IS_ERR(prima2_clks[i]));
        }
        clk_register_clkdev(prima2_clks[cpu], NULL, "cpu");
        clk_register_clkdev(prima2_clks[io],  NULL, "io");