Cleanup

Change-Id: I3b06eae4d8df73cd9f82279da73c48e548eeb494
diff --git a/zircon/system/core/devmgr/devcoordinator/device.cpp b/zircon/system/core/devmgr/devcoordinator/device.cpp
index 0eff1fa..2299a5b 100644
--- a/zircon/system/core/devmgr/devcoordinator/device.cpp
+++ b/zircon/system/core/devmgr/devcoordinator/device.cpp
@@ -503,7 +503,7 @@
     log(INFO, "%s: Running ddk compatibility test for driver %s \n", __func__, test_driver_name());
 
     // Device should be bound for test to work
-    if (!(flags & DEV_CTX_BOUND)) {
+    if (!(flags & DEV_CTX_BOUND) || children().is_empty()) {
         log(ERROR,
             "devcoordinator: Driver Compatibility test failed for %s: "
             "Parent Device not bound\n",
@@ -516,7 +516,7 @@
             "devcoordinator: Driver Compatibility test failed for %s: "
             "Event creation failed : %d\n",
             test_driver_name(), status);
-        return -1;
+        return ZX_ERR_NO_RESOURCES;
     }
 
     auto cleanup = fbl::MakeAutoCall([this]() {
@@ -534,7 +534,7 @@
                 "devcoordinator: Driver Compatibility test failed for %s: "
                 "Sending unbind to %s failed\n",
                 test_driver_name(), child.name().data());
-            return -1;
+            return ZX_ERR_INTERNAL;
         }
     }
 
@@ -558,7 +558,7 @@
                 "Error waiting for device to be removed.\n",
                 test_driver_name());
         }
-        return -1;
+        return ZX_ERR_BAD_STATE;
     }
     this->set_test_state(Device::TestStateMachine::kTestRemoveCalled);
     observed = 0;
@@ -581,7 +581,7 @@
                     "Error waiting for driver to be bound: %d\n",
                     test_driver_name(), status);
             }
-            return -1;
+            return ZX_ERR_BAD_STATE;
     }
     this->set_test_state(Device::TestStateMachine::kTestBindDone);
     if (this->children().is_empty()) {
diff --git a/zircon/system/core/devmgr/devcoordinator/device.h b/zircon/system/core/devmgr/devcoordinator/device.h
index d36d373..efa15ac 100644
--- a/zircon/system/core/devmgr/devcoordinator/device.h
+++ b/zircon/system/core/devmgr/devcoordinator/device.h
@@ -370,9 +370,11 @@
     zx::event& test_event() { return test_event_; }
 
     const char* test_driver_name() {return test_driver_name_; }
+
     void set_test_driver_name(const char* drivername) {
         strncpy(test_driver_name_, drivername, sizeof(test_driver_name_) - 1);
     }
+
 private:
     zx_status_t HandleRead();
     int RunCompatibilityTests();