Linux Audio

Check our new training course

Linux kernel drivers training

May 6-19, 2025
Register
Loading...
v6.13.7
 1/* SPDX-License-Identifier: GPL-2.0 */
 2#ifndef __ERR_H__
 3#define __ERR_H__
 4
 5#define MAX_ERRNO 4095
 6#define IS_ERR_VALUE(x) (unsigned long)(void *)(x) >= (unsigned long)-MAX_ERRNO
 7
 8#define __STR(x) #x
 9
10#define set_if_not_errno_or_zero(x, y)			\
11({							\
12	asm volatile ("if %0 s< -4095 goto +1\n"	\
13		      "if %0 s<= 0 goto +1\n"		\
14		      "%0 = " __STR(y) "\n"		\
15		      : "+r"(x));			\
16})
17
18static inline int IS_ERR_OR_NULL(const void *ptr)
19{
20	return !ptr || IS_ERR_VALUE((unsigned long)ptr);
21}
22
23static inline long PTR_ERR(const void *ptr)
24{
25	return (long) ptr;
26}
27
28#endif /* __ERR_H__ */
v6.8
 1/* SPDX-License-Identifier: GPL-2.0 */
 2#ifndef __ERR_H__
 3#define __ERR_H__
 4
 5#define MAX_ERRNO 4095
 6#define IS_ERR_VALUE(x) (unsigned long)(void *)(x) >= (unsigned long)-MAX_ERRNO
 7
 
 
 
 
 
 
 
 
 
 
 8static inline int IS_ERR_OR_NULL(const void *ptr)
 9{
10	return !ptr || IS_ERR_VALUE((unsigned long)ptr);
11}
12
13static inline long PTR_ERR(const void *ptr)
14{
15	return (long) ptr;
16}
17
18#endif /* __ERR_H__ */