unlock_return.cocci: Add vm_object_{hold,drop}().
authorSascha Wildner <saw@online.de>
Thu, 16 Aug 2012 17:53:40 +0000 (19:53 +0200)
committerSascha Wildner <saw@online.de>
Sat, 18 Aug 2012 22:29:14 +0000 (00:29 +0200)
test/cocci/unlock_return.cocci

index 6775567..1a8a392 100644 (file)
@@ -119,3 +119,21 @@ if (...) { ... when != spin_unlock(l)
 |
 spin_unlock(l);
 )
 |
 spin_unlock(l);
 )
+
+// vm_object_hold(...) / vm_object_drop(...)
+//
+@@
+expression l;
+@@
+vm_object_hold(l);
+... when != vm_object_drop(l)
+    when any
+    when strict
+(
+if (...) { ... when != vm_object_drop(l)
++   vm_object_drop(l);
+    return ...;
+}
+|
+vm_object_drop(l);
+)