summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephen Hines <srhines@google.com>2017-01-23 17:22:47 -0800
committerStephen Hines <srhines@google.com>2017-01-23 17:26:30 -0800
commitb45857ebc5cc15c8920be6b9b0c2c70e0707572c (patch)
treec1f86185185ccd6053cb9c64465dba6eb5751c66
parent13387baf267a4f74996c7172f8178fb6d4eb0a52 (diff)
downloadandroid_hardware_interfaces-b45857ebc5cc15c8920be6b9b0c2c70e0707572c.tar.gz
android_hardware_interfaces-b45857ebc5cc15c8920be6b9b0c2c70e0707572c.tar.bz2
android_hardware_interfaces-b45857ebc5cc15c8920be6b9b0c2c70e0707572c.zip
Fix some ordered comparisons with zero for pointers.
Bug: http://b/31532493 The latest clang will trigger an error diagnostic "ordered comparison between pointer and zero ..." when you do something like "p > 0". This change replaces the ordered comparisons with proper checks instead. Test: Validated with latest toolchain. Change-Id: I4a127fe2551688c8176bdd31210cf7f2f40baeba
-rw-r--r--memtrack/1.0/default/Memtrack.cpp2
-rw-r--r--power/1.0/default/Power.cpp10
2 files changed, 6 insertions, 6 deletions
diff --git a/memtrack/1.0/default/Memtrack.cpp b/memtrack/1.0/default/Memtrack.cpp
index 5c1a5c453..fa09c25ef 100644
--- a/memtrack/1.0/default/Memtrack.cpp
+++ b/memtrack/1.0/default/Memtrack.cpp
@@ -79,7 +79,7 @@ IMemtrack* HIDL_FETCH_IMemtrack(const char* name) {
memtrack_module_t *memtrack_module = NULL;
ret = hw_get_module(name, &hw_module);
- if (ret == 0 && hw_module->methods->open > 0)
+ if (ret == 0 && hw_module->methods->open)
{
ret = hw_module->methods->open(hw_module, name,
reinterpret_cast<hw_device_t**>(&memtrack_module));
diff --git a/power/1.0/default/Power.cpp b/power/1.0/default/Power.cpp
index 656a2ae51..6233a1420 100644
--- a/power/1.0/default/Power.cpp
+++ b/power/1.0/default/Power.cpp
@@ -40,14 +40,14 @@ Power::~Power() {
// Methods from ::android::hardware::power::V1_0::IPower follow.
Return<void> Power::setInteractive(bool interactive) {
- if (mModule->setInteractive > 0)
+ if (mModule->setInteractive)
mModule->setInteractive(mModule, interactive ? 1 : 0);
return Void();
}
Return<void> Power::powerHint(PowerHint hint, int32_t data) {
int32_t param = data;
- if (mModule->powerHint > 0) {
+ if (mModule->powerHint) {
if (data)
mModule->powerHint(mModule, static_cast<power_hint_t>(hint), &param);
else
@@ -57,7 +57,7 @@ Return<void> Power::powerHint(PowerHint hint, int32_t data) {
}
Return<void> Power::setFeature(Feature feature, bool activate) {
- if (mModule->setFeature > 0)
+ if (mModule->setFeature)
mModule->setFeature(mModule, static_cast<feature_t>(feature),
activate ? 1 : 0);
return Void();
@@ -79,7 +79,7 @@ Return<void> Power::getPlatformLowPowerStats(getPlatformLowPowerStats_cb _hidl_c
}
number_platform_modes = mModule->get_number_of_platform_modes(mModule);
- if (number_platform_modes > 0)
+ if (number_platform_modes)
{
if (SIZE_MAX / sizeof(size_t) <= number_platform_modes) // overflow
goto done;
@@ -149,7 +149,7 @@ IPower* HIDL_FETCH_IPower(const char* name) {
const hw_module_t* hw_module = NULL;
power_module_t *power_module;
ret = hw_get_module(name, &hw_module);
- if (ret == 0 && hw_module->methods->open > 0) {
+ if (ret == 0 && hw_module->methods->open) {
ret = hw_module->methods->open(hw_module, name,
reinterpret_cast<hw_device_t**>(&power_module));
if (ret == 0) {