diff --git a/drivers/video/fbdev/msm/mdss_smmu.c b/drivers/video/fbdev/msm/mdss_smmu.c index 9906f10a7911..9a00eff9ade9 100644 --- a/drivers/video/fbdev/msm/mdss_smmu.c +++ b/drivers/video/fbdev/msm/mdss_smmu.c @@ -172,6 +172,7 @@ static int mdss_smmu_attach_v2(struct mdss_data_type *mdata) struct mdss_smmu_client *mdss_smmu; int i, rc = 0; + mutex_lock(&mdp_iommu_lock); for (i = 0; i < MDSS_IOMMU_MAX_DOMAIN; i++) { if (!mdss_smmu_is_valid_domain_type(mdata, i)) continue; @@ -203,9 +204,12 @@ static int mdss_smmu_attach_v2(struct mdss_data_type *mdata) } } else { pr_err("iommu device not attached for domain[%d]\n", i); + mutex_unlock(&mdp_iommu_lock); return -ENODEV; } } + mutex_unlock(&mdp_iommu_lock); + return 0; err: @@ -217,6 +221,8 @@ err: mdss_smmu->domain_attached = false; } } + mutex_unlock(&mdp_iommu_lock); + return rc; } @@ -231,6 +237,7 @@ static int mdss_smmu_detach_v2(struct mdss_data_type *mdata) struct mdss_smmu_client *mdss_smmu; int i; + mutex_lock(&mdp_iommu_lock); for (i = 0; i < MDSS_IOMMU_MAX_DOMAIN; i++) { if (!mdss_smmu_is_valid_domain_type(mdata, i)) continue; @@ -239,6 +246,8 @@ static int mdss_smmu_detach_v2(struct mdss_data_type *mdata) if (mdss_smmu && mdss_smmu->dev && !mdss_smmu->handoff_pending) mdss_smmu_enable_power(mdss_smmu, false); } + mutex_unlock(&mdp_iommu_lock); + return 0; }