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

Commit c8f6285c authored by Sriharsha Allenki's avatar Sriharsha Allenki
Browse files

usb: phy: Fix deadlock because of mutex recursion



The driver acquires the lock on same mutex twice in
the DP DM regulator enable and disable call.
Fix this my removing the mutex_lock and unlock from
dpdm_regulator enable and disable calls.

Change-Id: Ib60c870a5026eac27d872161b22fc3f7f9605fc4
Signed-off-by: default avatarSriharsha Allenki <sallenki@codeaurora.org>
parent 709e9085
Loading
Loading
Loading
Loading
+0 −6
Original line number Diff line number Diff line
@@ -426,17 +426,14 @@ static int msm_snps_dpdm_regulator_enable(struct regulator_dev *rdev)
	int ret = 0;
	struct msm_snps_hsphy *phy = rdev_get_drvdata(rdev);

	mutex_lock(&phy->phy_lock);
	if (phy->dpdm_enable) {
		dev_dbg(phy->phy.dev, "%s: DP DM regulator already enabled\n",
								__func__);
		mutex_unlock(&phy->phy_lock);
		return 0;
	}

	msm_snps_hsphy_enable_regulators(phy);
	phy->dpdm_enable = true;
	mutex_unlock(&phy->phy_lock);

	return ret;
}
@@ -446,17 +443,14 @@ static int msm_snps_dpdm_regulator_disable(struct regulator_dev *rdev)
	int ret = 0;
	struct msm_snps_hsphy *phy = rdev_get_drvdata(rdev);

	mutex_lock(&phy->phy_lock);
	if (!phy->dpdm_enable) {
		dev_dbg(phy->phy.dev, "%s: DP DM regulator already enabled\n",
								__func__);
		mutex_unlock(&phy->phy_lock);
		return 0;
	}

	msm_snps_hsphy_disable_regulators(phy);
	phy->dpdm_enable = false;
	mutex_unlock(&phy->phy_lock);

	return ret;
}