From 9e672eb0d2e3fd9e376cb3f27b35461a2fd61db1 Mon Sep 17 00:00:00 2001 From: Ping Li Date: Tue, 24 Feb 2015 15:35:39 -0800 Subject: [PATCH] msm: mdss: Fix bugs in mdss code MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This patch fixes bugs in mdss code, including uninitialized variables, potential integer overflow, unnecessary condition check, incorrect use of logical and bitwise operator and unreleased memory in error case. Change-Id: Id579edc5e8f78aa8c295f1fccc88230ca00202ad Signed-off-by: Ping Li Adapted for K3.4 MDSS MDP (w/o mdss_panel.c) Signed-off-by: D. Andrei Măceș Signed-off-by: Francisco Franco --- drivers/video/msm/mdss/mdss_mdp.c | 1 + drivers/video/msm/mdss/mdss_mdp_pp.c | 12 ++++++------ 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/drivers/video/msm/mdss/mdss_mdp.c b/drivers/video/msm/mdss/mdss_mdp.c index 53944bcfccc2..c49b62118fcc 100644 --- a/drivers/video/msm/mdss/mdss_mdp.c +++ b/drivers/video/msm/mdss/mdss_mdp.c @@ -833,6 +833,7 @@ int mdss_iommu_init(struct mdss_data_type *mdata) layout.partitions = iomap->partitions; layout.npartitions = iomap->npartitions; layout.is_secure = (i == MDSS_IOMMU_DOMAIN_SECURE); + layout.domain_flags = 0; iomap->domain_idx = msm_register_domain(&layout); if (IS_ERR_VALUE(iomap->domain_idx)) diff --git a/drivers/video/msm/mdss/mdss_mdp_pp.c b/drivers/video/msm/mdss/mdss_mdp_pp.c index 1c3356f0d150..49e907c92df8 100644 --- a/drivers/video/msm/mdss/mdss_mdp_pp.c +++ b/drivers/video/msm/mdss/mdss_mdp_pp.c @@ -2820,7 +2820,7 @@ int mdss_mdp_ad_config(struct msm_fb_data_type *mfd, if (!lin_ret && !inv_ret) ad->state |= PP_AD_STATE_BL_LIN; else - ad->state &= !PP_AD_STATE_BL_LIN; + ad->state &= ~PP_AD_STATE_BL_LIN; ad->sts |= PP_AD_STS_DIRTY_INIT; } else if (init_cfg->ops & MDP_PP_AD_CFG) { @@ -2862,7 +2862,7 @@ int mdss_mdp_ad_input(struct msm_fb_data_type *mfd, mutex_lock(&ad->lock); if ((!PP_AD_STATE_IS_INITCFG(ad->state) && !PP_AD_STS_IS_DIRTY(ad->sts)) && - !input->mode == MDSS_AD_MODE_CALIB) { + (input->mode != MDSS_AD_MODE_CALIB)) { pr_warn("AD not initialized or configured."); ret = -EPERM; goto error; @@ -3138,10 +3138,10 @@ static int mdss_mdp_ad_setup(struct msm_fb_data_type *mfd) /* Clear state and regs when going to off state*/ ad->sts = 0; ad->sts |= PP_AD_STS_DIRTY_VSYNC; - ad->state &= !PP_AD_STATE_INIT; - ad->state &= !PP_AD_STATE_CFG; - ad->state &= !PP_AD_STATE_DATA; - ad->state &= !PP_AD_STATE_BL_LIN; + ad->state &= ~PP_AD_STATE_INIT; + ad->state &= ~PP_AD_STATE_CFG; + ad->state &= ~PP_AD_STATE_DATA; + ad->state &= ~PP_AD_STATE_BL_LIN; ad->bl_bright_shift = 0; ad->ad_data = 0; ad->ad_data_mode = 0;