drm/msm/dpu: Fix variable dereferenced before check
Subsystems (2)
PATCH RESEND 1/1 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 d7d0e73f7de3 ("drm/msm/dpu: introduce the dpu_encoder_phys_* for writeback")
Reported-by kernel test robot <[email protected]>
Reported-by Dan Carpenter <[email protected]>
Signed-off-by sunliming <[email protected]>
Reviewed-by Abhinav Kumar <[email protected]>
--- drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_wb.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_wb.c +5 -5
@@ -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 ;
@@ -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);
Signature · 1 line
2.25.1
Quoted 11 lines · sunliming
Fixes the following smatch warning:
drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_wb.c:261dpu_encoder_phys_wb_atomic_check()warn: variable dereferenced before check 'conn_state'Fixes d7d0e73f7de3 ("drm/msm/dpu: introduce the dpu_encoder_phys_* for writeback")Reported-by kernel test robot <[email protected]>Reported-by Dan Carpenter <[email protected]>Signed-off-by sunliming <[email protected]>Reviewed-by Abhinav Kumar <[email protected]>
Reviewed-by Dmitry Baryshkov <[email protected]>
Signature · 2 lines
With best wishes Dmitry