Skip to content

Commit

Permalink
msm: mdss: Fix bugs in mdss code
Browse files Browse the repository at this point in the history
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 <[email protected]>
Adapted for K3.4 MDSS MDP (w/o mdss_panel.c)
Signed-off-by: D. Andrei Măceș <[email protected]>
Signed-off-by: Francisco Franco <[email protected]>
  • Loading branch information
Ping Li authored and franciscofranco committed May 11, 2018
1 parent 851facb commit 9e672eb
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
1 change: 1 addition & 0 deletions drivers/video/msm/mdss/mdss_mdp.c
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
12 changes: 6 additions & 6 deletions drivers/video/msm/mdss/mdss_mdp_pp.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 9e672eb

Please sign in to comment.