Skip to content

Commit

Permalink
drm/msm/dpu: Fix variable dereferenced before check
Browse files Browse the repository at this point in the history
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: d7d0e73 ("drm/msm/dpu: introduce the dpu_encoder_phys_* for writeback")
Signed-off-by: sunliming <sunliming@kylinos.cn>
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Abhinav Kumar <quic_abhinavk@quicinc.com>
Patchwork: https://patchwork.freedesktop.org/patch/490850/
Link: https://lore.kernel.org/r/20220623012707.453972-1-sunliming@kylinos.cn
Signed-off-by: Abhinav Kumar <quic_abhinavk@quicinc.com>
  • Loading branch information
sunliming authored and Abhinav Kumar committed Jun 23, 2022
1 parent 0769d0a commit eb174bd
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_wb.c
Original file line number Diff line number Diff line change
Expand Up @@ -252,11 +252,6 @@ static int dpu_encoder_phys_wb_atomic_check(
DPU_DEBUG("[atomic_check:%d, \"%s\",%d,%d]\n",
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) {
DPU_ERROR("invalid connector state\n");
return -EINVAL;
Expand All @@ -267,6 +262,11 @@ static int dpu_encoder_phys_wb_atomic_check(
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,
fb->width, fb->height);

Expand Down

0 comments on commit eb174bd

Please sign in to comment.