Skip to content

Commit bfecbc2

Browse files
lumagAbhinav Kumar
authored andcommitted
drm/msm/dpu: make sure phys resources are properly initialized
The commit b954fa6 ("drm/msm/dpu: Refactor rm iterator") removed zero-init of the hw_ctl array, but didn't change the error condition, that checked for hw_ctl[i] being NULL. At the same time because of the early returns in case of an error dpu_encoder_phys might be left with the resources assigned in the previous state. Rework assigning of hw_pp / hw_ctl to the dpu_encoder_phys in order to make sure they are always set correctly. Fixes: b954fa6 ("drm/msm/dpu: Refactor rm iterator") Suggested-by: Abhinav Kumar <[email protected]> Signed-off-by: Dmitry Baryshkov <[email protected]> Reviewed-by: Abhinav Kumar <[email protected]> Patchwork: https://patchwork.freedesktop.org/patch/612233/ Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Abhinav Kumar <[email protected]>
1 parent 1530257 commit bfecbc2

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1174,21 +1174,20 @@ static void dpu_encoder_virt_atomic_mode_set(struct drm_encoder *drm_enc,
11741174
for (i = 0; i < dpu_enc->num_phys_encs; i++) {
11751175
struct dpu_encoder_phys *phys = dpu_enc->phys_encs[i];
11761176

1177-
if (!dpu_enc->hw_pp[i]) {
1177+
phys->hw_pp = dpu_enc->hw_pp[i];
1178+
if (!phys->hw_pp) {
11781179
DPU_ERROR_ENC(dpu_enc,
11791180
"no pp block assigned at idx: %d\n", i);
11801181
return;
11811182
}
11821183

1183-
if (!hw_ctl[i]) {
1184+
phys->hw_ctl = i < num_ctl ? to_dpu_hw_ctl(hw_ctl[i]) : NULL;
1185+
if (!phys->hw_ctl) {
11841186
DPU_ERROR_ENC(dpu_enc,
11851187
"no ctl block assigned at idx: %d\n", i);
11861188
return;
11871189
}
11881190

1189-
phys->hw_pp = dpu_enc->hw_pp[i];
1190-
phys->hw_ctl = to_dpu_hw_ctl(hw_ctl[i]);
1191-
11921191
phys->cached_mode = crtc_state->adjusted_mode;
11931192
if (phys->ops.atomic_mode_set)
11941193
phys->ops.atomic_mode_set(phys, crtc_state, conn_state);

0 commit comments

Comments
 (0)