From 2fe6c1701a78aeebbbdaa69c727017abd6c120df Mon Sep 17 00:00:00 2001 From: Badhri Jagan Sridharan Date: Wed, 29 Mar 2017 11:45:18 -0700 Subject: [PATCH] exynos9610: USB: HIDL: check the status of registerAsService registerAsService call could fail. Hence check the return value. Bug: 36704362 Change-Id: I46dcd74dbee6aba72cf344f10854e5d4b1b6de18 --- hidl/usb/service.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/hidl/usb/service.cpp b/hidl/usb/service.cpp index 2a53c3d..fbc099e 100644 --- a/hidl/usb/service.cpp +++ b/hidl/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 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; + } -- 2.20.1