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'
Unified · Split
| @@ -252,11 +252,6 @@ static int dpu_encoder_phys_wb_atomic_check( · 251 unmodified lines | ||
| 252 | 252 | DPU_DEBUG("[atomic_check:%d, \"%s\",%d,%d]\n", |
| 253 | 253 | phys_enc->wb_idx, mode->name, mode->hdisplay, mode->vdisplay); |
| 254 | 254 | |
| 255 | − if (!conn_state->writeback_job || !conn_state->writeback_job->fb) | |
| 256 | − return 0; | |
| 257 | − | |
| 258 | − fb = conn_state->writeback_job->fb; | |
| 259 | − | |
| 260 | 255 | if (!conn_state || !conn_state->connector) { |
| 261 | 256 | DPU_ERROR("invalid connector state\n"); |
| 262 | 257 | return -EINVAL; |
| @@ -267,6 +262,11 @@ static int dpu_encoder_phys_wb_atomic_check( · 4 unmodified lines | ||
| 267 | 262 | return -EINVAL; |
| 268 | 263 | } |
| 269 | 264 | |
| 265 | + if (!conn_state->writeback_job || !conn_state->writeback_job->fb) | |
| 266 | + return 0; | |
| 267 | + | |
| 268 | + fb = conn_state->writeback_job->fb; | |
| 269 | + | |
| 270 | 270 | DPU_DEBUG("[fb_id:%u][fb:%u,%u]\n", fb->base.id, |
| 271 | 271 | fb->width, fb->height); |
| 272 | 272 | |