Prefer using IS_ERR_OR_NULL() over using IS_ERR() and a manual NULL check. IS_ERR_OR_NULL() already uses likely(!ptr) internally. checkpatch does not like nesting it: > WARNING: nested (un)?likely() calls, IS_ERR_OR_NULL already uses > unlikely() internally Remove the explicit use of likely(). 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: Thomas Gleixner To: Ingo Molnar To: Borislav Petkov To: Dave Hansen To: x86@kernel.org To: "H. Peter Anvin" Cc: linux-kernel@vger.kernel.org Signed-off-by: Philipp Hahn --- arch/x86/kernel/callthunks.c | 2 +- arch/x86/kernel/irq.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/x86/kernel/callthunks.c b/arch/x86/kernel/callthunks.c index e37728f7032277a99ffb0e6bb7dfa318660e56a0..6dc45838d8e439e117815b85e2840bb3a6688ed8 100644 --- a/arch/x86/kernel/callthunks.c +++ b/arch/x86/kernel/callthunks.c @@ -212,7 +212,7 @@ static __init_or_module void patch_call(void *addr, const struct core_text *ct) return; dest = call_get_dest(addr); - if (!dest || WARN_ON_ONCE(IS_ERR(dest))) + if (WARN_ON_ONCE(IS_ERR_OR_NULL(dest))) return; if (!is_coretext(ct, dest)) diff --git a/arch/x86/kernel/irq.c b/arch/x86/kernel/irq.c index ec77be217eaf5f558fa73c2ff6cf1ab8953ee2f8..81963909066d72607f58d3e443a21a3b3e701a99 100644 --- a/arch/x86/kernel/irq.c +++ b/arch/x86/kernel/irq.c @@ -282,7 +282,7 @@ static __always_inline bool call_irq_handler(int vector, struct pt_regs *regs) { struct irq_desc *desc = __this_cpu_read(vector_irq[vector]); - if (likely(!IS_ERR_OR_NULL(desc))) { + if (!IS_ERR_OR_NULL(desc)) { handle_irq(desc, regs); return true; } -- 2.43.0