msm: sde: Fix SDE rotator driver error handling

Initialize some local variables before using them and safely return an
error code when encounter error cases in the SDE rotator driver.

CRs-Fixed: 1060558
Change-Id: I25406b13ac2007f1789d8d32e428c39dac4c29cf
Signed-off-by: Benjamin Chan <bkchan@codeaurora.org>
This commit is contained in:
Benjamin Chan 2016-08-18 23:55:21 -04:00
parent 436eeda4f1
commit 3990c6a17a
3 changed files with 8 additions and 5 deletions

View file

@ -316,7 +316,7 @@ static int sde_mdp_wb_wait4comp(struct sde_mdp_ctl *ctl, void *arg)
{ {
struct sde_mdp_writeback_ctx *ctx; struct sde_mdp_writeback_ctx *ctx;
int rc = 0; int rc = 0;
u64 rot_time; u64 rot_time = 0;
u32 status, mask, isr; u32 status, mask, isr;
ctx = (struct sde_mdp_writeback_ctx *) ctl->priv_data; ctx = (struct sde_mdp_writeback_ctx *) ctl->priv_data;

View file

@ -1566,8 +1566,8 @@ static int sde_hw_rotator_kickoff(struct sde_rot_hw_resource *hw,
if (!ctx) { if (!ctx) {
SDEROT_ERR("Cannot locate rotator ctx from sesison id:%d\n", SDEROT_ERR("Cannot locate rotator ctx from sesison id:%d\n",
entry->item.session_id); entry->item.session_id);
return -EINVAL;
} }
WARN_ON(ctx == NULL);
ret = sde_smmu_ctrl(1); ret = sde_smmu_ctrl(1);
if (IS_ERR_VALUE(ret)) { if (IS_ERR_VALUE(ret)) {
@ -1609,8 +1609,8 @@ static int sde_hw_rotator_wait4done(struct sde_rot_hw_resource *hw,
if (!ctx) { if (!ctx) {
SDEROT_ERR("Cannot locate rotator ctx from sesison id:%d\n", SDEROT_ERR("Cannot locate rotator ctx from sesison id:%d\n",
entry->item.session_id); entry->item.session_id);
return -EINVAL;
} }
WARN_ON(ctx == NULL);
ret = rot->ops.wait_rotator_done(ctx, ctx->q_id, 0); ret = rot->ops.wait_rotator_done(ctx, ctx->q_id, 0);
@ -1745,8 +1745,10 @@ static irqreturn_t sde_hw_rotator_regdmairq_handler(int irq, void *ptr)
q_id = ROT_QUEUE_LOW_PRIORITY; q_id = ROT_QUEUE_LOW_PRIORITY;
ts = (ts >> SDE_REGDMA_SWTS_SHIFT) & ts = (ts >> SDE_REGDMA_SWTS_SHIFT) &
SDE_REGDMA_SWTS_MASK; SDE_REGDMA_SWTS_MASK;
} else {
SDEROT_ERR("unknown ISR status: isr=0x%X\n", isr);
goto done_isr_handle;
} }
ctx = rot->rotCtx[q_id][ts & SDE_HW_ROT_REGDMA_SEG_MASK]; ctx = rot->rotCtx[q_id][ts & SDE_HW_ROT_REGDMA_SEG_MASK];
/* /*
@ -1766,6 +1768,7 @@ static irqreturn_t sde_hw_rotator_regdmairq_handler(int irq, void *ptr)
[ts & SDE_HW_ROT_REGDMA_SEG_MASK]; [ts & SDE_HW_ROT_REGDMA_SEG_MASK];
}; };
done_isr_handle:
spin_unlock(&rot->rotisr_lock); spin_unlock(&rot->rotisr_lock);
ret = IRQ_HANDLED; ret = IRQ_HANDLED;
} else if (isr & REGDMA_INT_ERR_MASK) { } else if (isr & REGDMA_INT_ERR_MASK) {

View file

@ -586,7 +586,7 @@ void sde_rot_ubwc_data_calc_offset(struct sde_mdp_data *data, u16 x, u16 y,
struct sde_mdp_plane_sizes *ps, struct sde_mdp_format_params *fmt) struct sde_mdp_plane_sizes *ps, struct sde_mdp_format_params *fmt)
{ {
u16 macro_w, micro_w, micro_h; u16 macro_w, micro_w, micro_h;
u32 offset; u32 offset = 0;
int ret; int ret;
ret = sde_rot_get_ubwc_micro_dim(fmt->format, &micro_w, &micro_h); ret = sde_rot_get_ubwc_micro_dim(fmt->format, &micro_w, &micro_h);