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

Commit 58dac184 authored by Subbaraman Narayanamurthy's avatar Subbaraman Narayanamurthy Committed by Harry Yang
Browse files

qpnp-fg-gen3: fix a possible wake source count leak



Currently, in the power supply notifier callback, GEN3 FG driver
calls pm_stay_awake() which increases the wake source count on
its device before it schedules status_change_work. In case, if
status_change_work is already pending, then pm_stay_awake() will
not have a balanced pm_relax() call as the work will not get
scheduled again if it's pending already. Fix this by scheduling
status_change_work and hence call pm_stay_awake() only if it is
not pending.

Change-Id: I2b8e28f6bfe1a5813410c7b1276d4e229eb67e84
Signed-off-by: default avatarSubbaraman Narayanamurthy <subbaram@codeaurora.org>
parent 243fc3f3
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -2448,6 +2448,9 @@ static int fg_notifier_cb(struct notifier_block *nb,
	if (event != PSY_EVENT_PROP_CHANGED)
		return NOTIFY_OK;

	if (work_pending(&chip->status_change_work))
		return NOTIFY_OK;

	if ((strcmp(psy->desc->name, "battery") == 0)
		|| (strcmp(psy->desc->name, "usb") == 0)) {
		/*