summaryrefslogtreecommitdiff
path: root/lib/igt.cocci
diff options
context:
space:
mode:
authorThomas Wood <thomas.wood@intel.com>2015-01-13 13:33:57 +0000
committerThomas Wood <thomas.wood@intel.com>2015-01-15 12:23:04 +0000
commit032f30cb38bb03562ee7fde19cd278b1d8ac31a9 (patch)
treeea6fea5eff9583a072c2f8174c00f57ab5cf1881 /lib/igt.cocci
parent07e9f3edb9dd8e99c2511b6b8c4cf750a5dbe536 (diff)
lib: remove unnecessary checks on the drm_open_any return value
drm_open_any always returns a valid file descriptor, so there is no need to check the return value. Signed-off-by: Thomas Wood <thomas.wood@intel.com>
Diffstat (limited to 'lib/igt.cocci')
-rw-r--r--lib/igt.cocci14
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/igt.cocci b/lib/igt.cocci
index 0d337bf7..fd4ad256 100644
--- a/lib/igt.cocci
+++ b/lib/igt.cocci
@@ -127,3 +127,17 @@ expression b;
- ((a) >= (b) ? (a) : (b))
+ max(a, b)
)
+
+// drm_open_any always returns a valid file descriptor
+@@
+expression a;
+@@
+a = drm_open_any();
+(
+- igt_assert(a >= 0);
+|
+- if (a < 0) {
+- ...
+- return ...;
+- }
+)