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

Commit 499359b9 authored by Subbaraman Narayanamurthy's avatar Subbaraman Narayanamurthy
Browse files

power: qpnp-fg-gen4: Fix a possible NULL pointer dereference



Currently, in get_batt_psy_props(), batt_psy can be used even
before it can be obtained. Fix it.

CRs-Fixed: 2221940
Change-Id: Icc86695f89a53802d60a6e2c4dd97b58922d267f
Signed-off-by: default avatarSubbaraman Narayanamurthy <subbaram@codeaurora.org>
parent 8e8b850c
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -913,6 +913,9 @@ static void get_batt_psy_props(struct fg_dev *fg)
	union power_supply_propval prop = {0, };
	int rc;

	if (!batt_psy_initialized(fg))
		return;

	rc = power_supply_get_property(fg->batt_psy, POWER_SUPPLY_PROP_STATUS,
			&prop);
	if (rc < 0) {