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

Commit ce54374d authored by Anirudh Ghayal's avatar Anirudh Ghayal
Browse files

power: qpnp-qg: Fix the check in PON SOC calculation



The current check always returns a positive value due
to a unsigned in wrap-around. Fix it.

Change-Id: I28fea4ff67ffed82465e5cfa785414069e4a180b
Signed-off-by: default avatarAnirudh Ghayal <aghayal@codeaurora.org>
parent b2e08d22
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -2661,7 +2661,7 @@ static int qg_determine_pon_soc(struct qpnp_qg *chip)
			goto done;
		}

		if ((full_soc - cutoff_soc) > 0 && (pon_soc - cutoff_soc) > 0)
		if ((full_soc > cutoff_soc) && (pon_soc > cutoff_soc))
			soc = DIV_ROUND_UP(((pon_soc - cutoff_soc) * 100),
						(full_soc - cutoff_soc));
		else