[PATCH 01/29] err.h: Add PTR_ERR_OR_ZERO from kernel
Sascha Hauer
s.hauer at pengutronix.de
Fri Mar 14 10:32:21 EDT 2014
Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
---
include/linux/err.h | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/include/linux/err.h b/include/linux/err.h
index 19fb70d..ed563f2 100644
--- a/include/linux/err.h
+++ b/include/linux/err.h
@@ -52,6 +52,14 @@ static inline void *ERR_CAST(const void *ptr)
return (void *) ptr;
}
+static inline int __must_check PTR_ERR_OR_ZERO(__force const void *ptr)
+{
+ if (IS_ERR(ptr))
+ return PTR_ERR(ptr);
+ else
+ return 0;
+}
+
#endif
#endif /* _LINUX_ERR_H */
--
1.9.0
More information about the barebox
mailing list