Merge tag 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost
[cris-mirror.git] / tools / virtio / linux / err.h
blob0943c644a701a458f53b8ed2806114d40e872445
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef ERR_H
3 #define ERR_H
4 #define MAX_ERRNO 4095
6 #define IS_ERR_VALUE(x) unlikely((x) >= (unsigned long)-MAX_ERRNO)
8 static inline void * __must_check ERR_PTR(long error)
10 return (void *) error;
13 static inline long __must_check PTR_ERR(const void *ptr)
15 return (long) ptr;
18 static inline long __must_check IS_ERR(const void *ptr)
20 return IS_ERR_VALUE((unsigned long)ptr);
23 static inline long __must_check IS_ERR_OR_NULL(const void *ptr)
25 return !ptr || IS_ERR_VALUE((unsigned long)ptr);
27 #endif /* ERR_H */