diff options
author | Nick Vaccaro <nvaccaro@google.com> | 2014-03-25 21:23:47 +0000 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2014-03-25 21:23:47 +0000 |
commit | 0a04947756a348222de1a0d06e2cba70a4a8f9b1 (patch) | |
tree | 7648d095f3b9bb57b42ce6198171b6bd9d83e9f1 /modules | |
parent | 0b78afb191aa3c8748bf4837e4693801f3ee762e (diff) | |
parent | 286c139bcce4107c24a3fd2122c042c98a223f49 (diff) | |
download | hardware_libhardware-0a04947756a348222de1a0d06e2cba70a4a8f9b1.zip hardware_libhardware-0a04947756a348222de1a0d06e2cba70a4a8f9b1.tar.gz hardware_libhardware-0a04947756a348222de1a0d06e2cba70a4a8f9b1.tar.bz2 |
am 286c139b: am 93bf9964: Fix sensor multi hal crash when sub-HAL reports an error
* commit '286c139bcce4107c24a3fd2122c042c98a223f49':
Fix sensor multi hal crash when sub-HAL reports an error
Diffstat (limited to 'modules')
-rw-r--r-- | modules/sensors/multihal.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/modules/sensors/multihal.cpp b/modules/sensors/multihal.cpp index a145c37..36345f9 100644 --- a/modules/sensors/multihal.cpp +++ b/modules/sensors/multihal.cpp @@ -214,9 +214,11 @@ int sensors_poll_context_t::get_device_version_by_handle(int handle) { } int sensors_poll_context_t::activate(int handle, int enabled) { + int retval = -EINVAL; ALOGV("activate"); sensors_poll_device_t* v0 = this->get_v0_device_by_handle(handle); - int retval = v0->activate(v0, get_local_handle(handle), enabled); + if (v0) + retval = v0->activate(v0, get_local_handle(handle), enabled); ALOGV("retval %d", retval); return retval; } @@ -576,7 +578,8 @@ static int open_sensors(const struct hw_module_t* hw_module, const char* name, sensors_module_t *sensors_module = (sensors_module_t*) *it; struct hw_device_t* sub_hw_device; int sub_open_result = sensors_module->common.methods->open(*it, name, &sub_hw_device); - dev->addSubHwDevice(sub_hw_device); + if (!sub_open_result) + dev->addSubHwDevice(sub_hw_device); } // Prepare the output param and return |