m-chrzan.xyz
aboutsummaryrefslogtreecommitdiff
path: root/util.h
diff options
context:
space:
mode:
Diffstat (limited to 'util.h')
-rw-r--r--util.h22
1 files changed, 22 insertions, 0 deletions
diff --git a/util.h b/util.h
new file mode 100644
index 0000000..bd9bcc3
--- /dev/null
+++ b/util.h
@@ -0,0 +1,22 @@
+#ifndef UTIL_H
+#define UTIL_H
+
+#define ORFAIL(cond, label) \
+({ \
+ err = (cond); \
+ if (err < 0) { \
+ goto label; \
+ } \
+})
+
+#define ORFAIL_PTR(cond, lvalue, label) \
+({ \
+ lvalue = (cond); \
+ if (IS_ERR(lvalue)) { \
+ err = PTR_ERR(lvalue); \
+ goto label; \
+ } \
+})
+
+
+#endif