err.h (1221ce459d04a428f8880f58581f671b736c3c27) err.h (f790ca7c7dfd6b96d418a29d4a8654cdfebbdfc3)
1#ifndef _LINUX_ERR_H
2#define _LINUX_ERR_H
3
4#include <linux/compiler.h>
5#include <linux/compat.h>
6
7#include <linux/errno.h>
8

--- 22 unchanged lines hidden (view full) ---

31 return (long) ptr;
32}
33
34static inline long IS_ERR(const void *ptr)
35{
36 return IS_ERR_VALUE((unsigned long)ptr);
37}
38
1#ifndef _LINUX_ERR_H
2#define _LINUX_ERR_H
3
4#include <linux/compiler.h>
5#include <linux/compat.h>
6
7#include <linux/errno.h>
8

--- 22 unchanged lines hidden (view full) ---

31 return (long) ptr;
32}
33
34static inline long IS_ERR(const void *ptr)
35{
36 return IS_ERR_VALUE((unsigned long)ptr);
37}
38
39static inline bool IS_ERR_OR_NULL(const void *ptr)
40{
41 return !ptr || IS_ERR_VALUE((unsigned long)ptr);
42}
43
39/**
40 * ERR_CAST - Explicitly cast an error-valued pointer to another pointer type
41 * @ptr: The pointer to cast.
42 *
43 * Explicitly cast an error-valued pointer to another pointer type in such a
44 * way as to make it clear that's what's going on.
45 */
46static inline void * __must_check ERR_CAST(__force const void *ptr)
47{
48 /* cast away the const */
49 return (void *) ptr;
50}
51
52#endif
53
54#endif /* _LINUX_ERR_H */
44/**
45 * ERR_CAST - Explicitly cast an error-valued pointer to another pointer type
46 * @ptr: The pointer to cast.
47 *
48 * Explicitly cast an error-valued pointer to another pointer type in such a
49 * way as to make it clear that's what's going on.
50 */
51static inline void * __must_check ERR_CAST(__force const void *ptr)
52{
53 /* cast away the const */
54 return (void *) ptr;
55}
56
57#endif
58
59#endif /* _LINUX_ERR_H */