summaryrefslogtreecommitdiffstats
path: root/include/linux/err.h
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2012-09-21 11:55:50 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2012-10-04 15:19:54 +0200
commit6f4dd1b20438d2e313c0baab2df49e5d243483c2 (patch)
tree6a95aff38b478be7d75b058dcc991194c474da30 /include/linux/err.h
parent83b0ed7fbfd2baf0b3ec0d66c201fced57af2d1d (diff)
downloadbarebox-6f4dd1b20438d2e313c0baab2df49e5d243483c2.tar.gz
barebox-6f4dd1b20438d2e313c0baab2df49e5d243483c2.tar.xz
err.h: introduce IS_ERR_OR_NULL
Copied from Linux. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'include/linux/err.h')
-rw-r--r--include/linux/err.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/include/linux/err.h b/include/linux/err.h
index e0d8d2d33a..19fb70dc08 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.