Prefer using IS_ERR_OR_NULL() over using IS_ERR() and a manual NULL check. Semantich change: Previously the code only printed the warning on error, but not when the pointer was NULL. Now the warning is printed in both cases!
Change found with coccinelle. To: Michael Turquette <[email protected]> To: Stephen Boyd <[email protected]> To: Daniel Lezcano <[email protected]> To: Thomas Gleixner <[email protected]> Cc: [email protected] Cc: [email protected] Signed-off-by: Philipp Hahn <[email protected]> --- drivers/clk/clk.c | 4 ++-- drivers/clocksource/timer-pxa.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c index 47093cda9df32223c1120c3710261296027c4cd3..35146e3869a7dd93741d10b7223d4488a9216ed1 100644 --- a/drivers/clk/clk.c +++ b/drivers/clk/clk.c @@ -4558,7 +4558,7 @@ void clk_unregister(struct clk *clk) unsigned long flags; const struct clk_ops *ops; - if (!clk || WARN_ON_ONCE(IS_ERR(clk))) + if (WARN_ON_ONCE(IS_ERR_OR_NULL(clk))) return; clk_debug_unregister(clk->core); @@ -4744,7 +4744,7 @@ void __clk_put(struct clk *clk) { struct module *owner; - if (!clk || WARN_ON_ONCE(IS_ERR(clk))) + if (WARN_ON_ONCE(IS_ERR_OR_NULL(clk))) return; clk_prepare_lock(); diff --git a/drivers/clocksource/timer-pxa.c b/drivers/clocksource/timer-pxa.c index 7ad0e5adb2ffac4125c34710fc67f4b45f30331d..f65fb0b7fc318b766227e5e7a4c0fb08ba11c8f9 100644 --- a/drivers/clocksource/timer-pxa.c +++ b/drivers/clocksource/timer-pxa.c @@ -218,7 +218,7 @@ void __init pxa_timer_nodt_init(int irq, void __iomem *base) timer_base = base; clk = clk_get(NULL, "OSTIMER0"); - if (clk && !IS_ERR(clk)) { + if (!IS_ERR_OR_NULL(clk)) { clk_prepare_enable(clk); pxa_timer_common_init(irq, clk_get_rate(clk)); } else { -- 2.43.0
