Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 895a3036 authored by Luca Weiss's avatar Luca Weiss Committed by Bharath
Browse files

power: fg-alg: return -1 instead of -EINVAL on error

Align our code to the return value found in other versions of the patch
"power: qpnp-qg: Add TTF_VALID param for valid TTF/TTE reporting".

This stops the time_to_full_now attribute from returning -22 (-EINVAL)
when the battery is fully charged which VTS is not happy about.

Issue: FP3-A12#4
Test: run vts -m VtsHalHealthV2_1TargetTest -t PerInstance/HealthHidlTest#getHealthInfo_2_1/0_default
Change-Id: Ib36d74a4cbed0c125217bd15c07de5eff2c42659
parent 712e3058
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -813,7 +813,7 @@ static int get_time_to_full_locked(struct ttf *ttf, int *val)
	}

	if (!valid) {
		*val = -EINVAL;
		*val = -1;
		return 0;
	}

@@ -824,7 +824,7 @@ static int get_time_to_full_locked(struct ttf *ttf, int *val)
	}

	if (charge_status != POWER_SUPPLY_STATUS_CHARGING) {
		*val = -EINVAL;
		*val = -1;
		return 0;
	}

@@ -1145,7 +1145,7 @@ int ttf_get_time_to_empty(struct ttf *ttf, int *val)
	}

	if (!valid) {
		*val = -EINVAL;
		*val = -1;
		return 0;
	}

@@ -1156,7 +1156,7 @@ int ttf_get_time_to_empty(struct ttf *ttf, int *val)
	}

	if (charge_status == POWER_SUPPLY_STATUS_CHARGING) {
		*val = -EINVAL;
		*val = -1;
		return 0;
	}