checkpatch: check for nested (un)?likely() calls

IS_ERR(), IS_ERR_OR_NULL(), IS_ERR_VALUE() and WARN*() already contain
unlikely() optimization internally.  Thus, there is no point in calling
these functions and defines under likely()/unlikely().

This check is based on the coccinelle rule developed by Enrico Weigelt

Signed-off-by: Denis Efremov <>
Cc: Joe Perches <>
Cc: Alexander Viro <>
Cc: Anton Altaparmakov <>
Cc: Boris Ostrovsky <>
Cc: Boris Pismenny <>
Cc: Darrick J. Wong <>
Cc: "David S. Miller" <>
Cc: Denis Efremov <>
Cc: Dennis Dalessandro <>
Cc: Inaky Perez-Gonzalez <>
Cc: Juergen Gross <>
Cc: Leon Romanovsky <>
Cc: Mike Marciniszyn <>
Cc: Rob Clark <>
Cc: Saeed Mahameed <>
Cc: Sean Paul <>
Signed-off-by: Andrew Morton <>
1 file changed