From: Levin, Alexander (Sasha Levin) Date: Thu, 25 May 2017 12:58:56 +0000 (+0000) Subject: tools/include: Add IS_ERR_OR_NULL to err.h X-Git-Tag: v4.13-rc1~207^2~12 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=61d4595eed163ea416c13c4b994f22190711151b;p=karo-tx-linux.git tools/include: Add IS_ERR_OR_NULL to err.h Signed-off-by: Sasha Levin Cc: Linus Torvalds Cc: Peter Zijlstra Cc: Thomas Gleixner Cc: a.p.zijlstra@chello.nl Cc: ben@decadent.org.uk Link: http://lkml.kernel.org/r/20170525130005.5947-20-alexander.levin@verizon.com Signed-off-by: Ingo Molnar --- diff --git a/tools/include/linux/err.h b/tools/include/linux/err.h index bdc3dd8131d4..abf0478a8fb2 100644 --- a/tools/include/linux/err.h +++ b/tools/include/linux/err.h @@ -46,4 +46,9 @@ static inline bool __must_check IS_ERR(__force const void *ptr) return IS_ERR_VALUE((unsigned long)ptr); } +static inline bool __must_check IS_ERR_OR_NULL(__force const void *ptr) +{ + return unlikely(!ptr) || IS_ERR_VALUE((unsigned long)ptr); +} + #endif /* _LINUX_ERR_H */