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

Commit 21c602f8 authored by Nicholas Troast's avatar Nicholas Troast Committed by Gerrit - the friendly Code Review server
Browse files

power: qpnp-fg: fix error condition in get_batt_id



The bias current is identified only by the lower two bits, and its
value can be 1, 2, or 3. The current bounds check is incorrect. Fix
it.

CRs-Fixed: 857879
Change-Id: Icf34d1144904b9d41f5181625dcf598c247e33d3
Signed-off-by: default avatarNicholas Troast <ntroast@codeaurora.org>
parent bbfb0c59
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -1646,8 +1646,8 @@ static int64_t get_batt_id(unsigned int battery_id_uv, u8 bid_info)
{
	u64 battery_id_ohm;

	if (!(bid_info & 0x3) >= 1) {
		pr_err("can't determine battery id %d\n", bid_info);
	if ((bid_info & 0x3) == 0) {
		pr_err("can't determine battery id 0x%02x\n", bid_info);
		return -EINVAL;
	}