From 391f8bee7ef5a2e92d24d73f0072915b7cb12b6b Mon Sep 17 00:00:00 2001 From: Marcin Chrzanowski Date: Thu, 3 May 2018 12:52:32 +0200 Subject: Create basic char device --- util.h | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 util.h (limited to 'util.h') 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 -- cgit v1.2.3