Commit eb174bd8 authored by sunliming's avatar sunliming Committed by Abhinav Kumar

drm/msm/dpu: Fix variable dereferenced before check

Fixes the following smatch warning:

drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_wb.c:261
dpu_encoder_phys_wb_atomic_check() warn: variable dereferenced before check 'conn_state'

Fixes: d7d0e73f ("drm/msm/dpu: introduce the dpu_encoder_phys_* for writeback")
Signed-off-by: default avatarsunliming <sunliming@kylinos.cn>
Reported-by: default avatarkernel test robot <lkp@intel.com>
Reported-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: default avatarAbhinav Kumar <quic_abhinavk@quicinc.com>
Patchwork: https://patchwork.freedesktop.org/patch/490850/
Link: https://lore.kernel.org/r/20220623012707.453972-1-sunliming@kylinos.cnSigned-off-by: default avatarAbhinav Kumar <quic_abhinavk@quicinc.com>
parent 0769d0a7
...@@ -252,11 +252,6 @@ static int dpu_encoder_phys_wb_atomic_check( ...@@ -252,11 +252,6 @@ static int dpu_encoder_phys_wb_atomic_check(
DPU_DEBUG("[atomic_check:%d, \"%s\",%d,%d]\n", DPU_DEBUG("[atomic_check:%d, \"%s\",%d,%d]\n",
phys_enc->wb_idx, mode->name, mode->hdisplay, mode->vdisplay); phys_enc->wb_idx, mode->name, mode->hdisplay, mode->vdisplay);
if (!conn_state->writeback_job || !conn_state->writeback_job->fb)
return 0;
fb = conn_state->writeback_job->fb;
if (!conn_state || !conn_state->connector) { if (!conn_state || !conn_state->connector) {
DPU_ERROR("invalid connector state\n"); DPU_ERROR("invalid connector state\n");
return -EINVAL; return -EINVAL;
...@@ -267,6 +262,11 @@ static int dpu_encoder_phys_wb_atomic_check( ...@@ -267,6 +262,11 @@ static int dpu_encoder_phys_wb_atomic_check(
return -EINVAL; return -EINVAL;
} }
if (!conn_state->writeback_job || !conn_state->writeback_job->fb)
return 0;
fb = conn_state->writeback_job->fb;
DPU_DEBUG("[fb_id:%u][fb:%u,%u]\n", fb->base.id, DPU_DEBUG("[fb_id:%u][fb:%u,%u]\n", fb->base.id,
fb->width, fb->height); fb->width, fb->height);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment