summaryrefslogtreecommitdiff
path: root/usb
diff options
context:
space:
mode:
authorBadhri Jagan Sridharan <Badhri@google.com>2017-03-29 11:45:18 -0700
committerBadhri Jagan Sridharan <Badhri@google.com>2017-04-04 10:38:37 -0700
commit49e7f44507fcbb8529cabe688081531932dd7f25 (patch)
treee03b26a71f34fd42270742077d5808a4dee16b89 /usb
parent8f6890a219165c07f8a370144a6680d33f7b37ef (diff)
downloadwahoo-49e7f44507fcbb8529cabe688081531932dd7f25.tar.gz
USB: HIDL: check the status of registerAsService
registerAsService call could fail. Hence check the return value. Bug: 36704362 Change-Id: I46dcd74dbee6aba72cf344f10854e5d4b1b6de18
Diffstat (limited to 'usb')
-rw-r--r--usb/service.cpp14
1 files changed, 13 insertions, 1 deletions
diff --git a/usb/service.cpp b/usb/service.cpp
index 2a53c3d1..fbc099ee 100644
--- a/usb/service.cpp
+++ b/usb/service.cpp
@@ -27,12 +27,24 @@ using android::hardware::joinRpcThreadpool;
using android::hardware::usb::V1_0::IUsb;
using android::hardware::usb::V1_0::implementation::Usb;
+using android::status_t;
+using android::OK;
+
int main() {
android::sp<IUsb> service = new Usb();
configureRpcThreadpool(1, true /*callerWillJoin*/);
- service->registerAsService();
+ status_t status = service->registerAsService();
+
+ if (status != OK) {
+ ALOGE("Cannot register USB HAL service");
+ return 1;
+ }
ALOGI("USB HAL Ready.");
joinRpcThreadpool();
+ // Under noraml cases, execution will not reach this line.
+ ALOGI("USB HAL failed to join thread pool.");
+ return 1;
+
}