Bug 758097: fix false warnings in debug build when reading switch uevent. r=mwu
authorCervantes Yu <cyu@mozilla.com>
Fri, 25 May 2012 15:56:03 +0800
changeset 94927 13236f855e375312ef3fa4300622f8c1d3851b6d
parent 94926 97b524dbc4add0dbb1fef5d5598ac83fcd382c5f
child 94928 3697e932626dfc5f1a4f4277add29333e0091b57
push id9875
push userkchen@mozilla.com
push dateFri, 25 May 2012 07:56:43 +0000
treeherdermozilla-inbound@3697e932626d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmwu
bugs758097
milestone15.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 758097: fix false warnings in debug build when reading switch uevent. r=mwu
hal/gonk/GonkSwitch.cpp
--- a/hal/gonk/GonkSwitch.cpp
+++ b/hal/gonk/GonkSwitch.cpp
@@ -141,19 +141,18 @@ private:
 
     if (!*name || !*state) {
       return false;
     }
     return true;
   }
 
   SwitchDevice ProcessEvent(const NetlinkEvent& event, const char** name, const char** state) {
-    bool rv = GetEventInfo(event, name, state);
-    NS_ENSURE_TRUE(rv, SWITCH_DEVICE_UNKNOWN);
-    return NameToDevice(*name);
+    return GetEventInfo(event, name, state) ?
+      NameToDevice(*name) : SWITCH_DEVICE_UNKNOWN;
   }
 };
 
 SwitchEventObserver* sSwitchObserver;
 
 static void
 InitializeResourceIfNeed()
 {