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 94942 13236f855e375312ef3fa4300622f8c1d3851b6d
parent 94941 97b524dbc4add0dbb1fef5d5598ac83fcd382c5f
child 94943 3697e932626dfc5f1a4f4277add29333e0091b57
push idunknown
push userunknown
push dateunknown
reviewersmwu
bugs758097
milestone15.0a1
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()
 {