m-chrzan.xyz
aboutsummaryrefslogtreecommitdiff
path: root/util.h
diff options
context:
space:
mode:
authorMarcin Chrzanowski <marcin.j.chrzanowski@gmail.com>2018-05-03 12:52:32 +0200
committerMarcin Chrzanowski <marcin.j.chrzanowski@gmail.com>2018-05-03 12:52:32 +0200
commit391f8bee7ef5a2e92d24d73f0072915b7cb12b6b (patch)
tree33f48bf55069bc3a2f26d7d3e3866f519959fa3a /util.h
parent66bcebae16314268dfc64ed89072feca862be108 (diff)
Create basic char device
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