Checker: Value stored to 'kernResult' is never read (LayoutTestHelper.m:164)
authorddkilzer@apple.com <ddkilzer@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 20 Jul 2014 15:08:06 +0000 (15:08 +0000)
committerddkilzer@apple.com <ddkilzer@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 20 Jul 2014 15:08:06 +0000 (15:08 +0000)
<http://webkit.org/b/135096>

Reviewed by Alexey Proskuryakov.

* DumpRenderTree/mac/LayoutTestHelper.m:
(lockDownDiscreteGraphics): Check the return values of
IOServiceOpen() and IOObjectRelease(), and log if not
KERN_SUCCESS.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@171277 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Tools/ChangeLog
Tools/DumpRenderTree/mac/LayoutTestHelper.m

index 380c30a96b28ebf7bd681c48ae6d7a032a03a9b0..57a615266bbe952b48c606377762633569e70d8e 100644 (file)
@@ -1,3 +1,15 @@
+2014-07-20  David Kilzer  <ddkilzer@apple.com>
+
+        Checker: Value stored to 'kernResult' is never read (LayoutTestHelper.m:164)
+        <http://webkit.org/b/135096>
+
+        Reviewed by Alexey Proskuryakov.
+
+        * DumpRenderTree/mac/LayoutTestHelper.m:
+        (lockDownDiscreteGraphics): Check the return values of
+        IOServiceOpen() and IOObjectRelease(), and log if not
+        KERN_SUCCESS.
+
 2014-07-19  Anders Carlsson  <andersca@apple.com>
 
         Update.
index 3d09a31c1be459e96f6466dc4c2d44e70c7bba88..bc8aec84ddf4cda98db26444503f4db109b0c5d9 100644 (file)
@@ -162,7 +162,14 @@ void lockDownDiscreteGraphics()
 
     // This call stalls until the graphics device lock is granted.
     kernResult = IOServiceOpen(serviceObject, mach_task_self(), 1, &permanentLockDownService);
-    IOObjectRelease(serviceObject);
+    if (kernResult != KERN_SUCCESS) {
+        NSLog(@"IOServiceOpen() failed in %s with kernResult = %d", __FUNCTION__, kernResult);
+        return;
+    }
+
+    kernResult = IOObjectRelease(serviceObject);
+    if (kernResult != KERN_SUCCESS)
+        NSLog(@"IOObjectRelease() failed in %s with kernResult = %d", __FUNCTION__, kernResult);
 }
 
 int main(int argc, char* argv[])