m-chrzan.xyz
aboutsummaryrefslogtreecommitdiff
path: root/util.h
blob: a5606ad992ce44002f0892a89f03117f1a4d3bb4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#ifndef UTIL_H
#define UTIL_H

#define ORFAIL(cond, label) \
({ \
	err = (cond); \
	if (err < 0) { \
		goto label; \
	} \
})

#define ORFAIL_PTR(ptr, label) \
({ \
	if (IS_ERR(ptr)) { \
		err = PTR_ERR(ptr); \
		goto label; \
	} \
})

#define ORFAIL_NULL(ptr, error, label) \
({ \
	if (ptr == NULL) { \
		err = error; \
		goto label; \
	} \
})

#endif