diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2013-12-10 15:22:13 +0100 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2014-03-14 15:25:19 +0100 |
commit | bcfd4b5d9d6d2a5ce03fa8ced7be1cdd688e1762 (patch) | |
tree | 660abf119e93b1b1581cfe43c33a5235f9650655 | |
parent | b626e2b913cfdc01a220faf209fe9f63a5b5aa9d (diff) | |
download | barebox-bcfd4b5d9d6d2a5ce03fa8ced7be1cdd688e1762.tar.gz |
err.h: Add PTR_ERR_OR_ZERO from kernel
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
-rw-r--r-- | include/linux/err.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/include/linux/err.h b/include/linux/err.h index 19fb70dc08..ed563f2c4a 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 */ |