5 * Kernel pointers have redundant information, so we can use a
6 * scheme where we can return either an error code or a dentry
7 * pointer with the same return value.
9 * This should be a per-architecture thing, to allow different
10 * error and pointer decisions.
12 #define MAX_ERRNO 4095
14 #define IS_ERR_VALUE(x) ((x) >= (uintptr_t)-MAX_ERRNO)
16 static inline void *ERR_PTR(uintptr_t error)
18 return (void *) error;
21 static inline uintptr_t PTR_ERR(const void *ptr)
23 return (uintptr_t) ptr;
26 static inline uintptr_t IS_ERR(const void *ptr)
28 return IS_ERR_VALUE((uintptr_t)ptr);
31 static inline uintptr_t IS_ERR_OR_NULL(const void *ptr)
33 return !ptr || IS_ERR_VALUE((uintptr_t)ptr);
36 static inline int PTR_ERR_OR_ZERO(const void *ptr)