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

Commit 33244abf authored by Prudhvi Yarlagadda's avatar Prudhvi Yarlagadda Committed by Gerrit - the friendly Code Review server
Browse files

slim-msm-ngd: Prevent race condition between resume and SSR



Prevents the possible race condition between slimbus resume
and slimbus SSR function execution. When SSR callback function
takes mutex lock ahead of resume function, it results in qmi
NULL pointer dereference in resume function as SSR function
execution makes it NULL.

Change-Id: I531d62077329624cf09044235859a2db328892a0
Signed-off-by: default avatarPrudhvi Yarlagadda <pyarlaga@codeaurora.org>
parent 8fa5b27a
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -2071,9 +2071,9 @@ static int ngd_slim_runtime_resume(struct device *device)
	int ret = 0;

	mutex_lock(&dev->tx_lock);
	if (dev->state >= MSM_CTRL_ASLEEP)
	if ((dev->state >= MSM_CTRL_ASLEEP) && (dev->qmi.handle != NULL))
		ret = ngd_slim_power_up(dev, false);
	if (ret) {
	if (ret || dev->qmi.handle == NULL) {
		/* Did SSR cause this power up failure */
		if (dev->state != MSM_CTRL_DOWN)
			dev->state = MSM_CTRL_ASLEEP;
@@ -2142,7 +2142,7 @@ static int ngd_slim_suspend(struct device *dev)
			cdev->qmi.deferred_resp = false;
		}
	}
	SLIM_INFO(cdev, "system suspend\n");
	SLIM_INFO(cdev, "system suspend state: %d\n", cdev->state);
	return ret;
}

@@ -2176,7 +2176,7 @@ static int ngd_slim_resume(struct device *dev)
	 * Even if it's not enabled, rely on 1st client transaction to do
	 * clock/power on
	 */
	SLIM_INFO(cdev, "system resume\n");
	SLIM_INFO(cdev, "system resume state: %d\n", cdev->state);
	return ret;
}
#endif /* CONFIG_PM_SLEEP */