[PATCH 01/23] err.h: introduce IS_ERR_OR_NULL

Sascha Hauer s.hauer at pengutronix.de
Mon Sep 24 07:04:30 EDT 2012


Copied from Linux.

Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
---
 include/linux/err.h |    5 +++++
 1 file changed, 5 insertions(+)

diff --git a/include/linux/err.h b/include/linux/err.h
index e0d8d2d..19fb70d 100644
--- a/include/linux/err.h
+++ b/include/linux/err.h
@@ -34,6 +34,11 @@ static inline long IS_ERR(const void *ptr)
 	return IS_ERR_VALUE((unsigned long)ptr);
 }
 
+static inline long __must_check IS_ERR_OR_NULL(const void *ptr)
+{
+	return !ptr || IS_ERR_VALUE((unsigned long)ptr);
+}
+
 /**
  * ERR_CAST - Explicitly cast an error-valued pointer to another pointer type
  * @ptr: The pointer to cast.
-- 
1.7.10.4




More information about the barebox mailing list