healthd: Fix incorrect return check
In commit1d4368b494
("[REFACTOR] healthd: BatteryMonitor use health 2.1 types"), the mapSysfsString() function was changed to return NULL instead of -1 on error. Everywher else that function is used commit1d4368b494
tweaked the return value check from (ret < 0) to (!ret), but one spot was missed. This patch corrects the one missed check so that we compare against null rather then negative value, since the return value can no longer be negative. This issue was found by inspection, and I've not seen an actual problem with it, but thought it should be corrected. Change-Id: I0a6564274d01276352a5dc0660b8ffbe748b5fde Signed-off-by: John Stultz <john.stultz@linaro.org>
This commit is contained in:
parent
2aabeed1fd
commit
47a6bf014d
|
@ -168,7 +168,7 @@ BatteryMonitor::PowerSupplyType BatteryMonitor::readPowerSupplyType(const String
|
|||
return ANDROID_POWER_SUPPLY_TYPE_UNKNOWN;
|
||||
|
||||
auto ret = mapSysfsString(buf.c_str(), supplyTypeMap);
|
||||
if (ret < 0) {
|
||||
if (!ret) {
|
||||
KLOG_WARNING(LOG_TAG, "Unknown power supply type '%s'\n", buf.c_str());
|
||||
*ret = ANDROID_POWER_SUPPLY_TYPE_UNKNOWN;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue