Skip to content

Commit aedf02e

Browse files
author
Abhinav Kumar
committed
drm/msm/dpu: move dpu_encoder's connector assignment to atomic_enable()
For cases where the crtc's connectors_changed was set without enable/active getting toggled , there is an atomic_enable() call followed by an atomic_disable() but without an atomic_mode_set(). This results in a NULL ptr access for the dpu_encoder_get_drm_fmt() call in the atomic_enable() as the dpu_encoder's connector was cleared in the atomic_disable() but not re-assigned as there was no atomic_mode_set() call. Fix the NULL ptr access by moving the assignment for atomic_enable() and also use drm_atomic_get_new_connector_for_encoder() to get the connector from the atomic_state. Fixes: 25fdd59 ("drm/msm: Add SDM845 DPU support") Reported-by: Dmitry Baryshkov <[email protected]> Closes: https://gitlab.freedesktop.org/drm/msm/-/issues/59 Suggested-by: Dmitry Baryshkov <[email protected]> Reviewed-by: Dmitry Baryshkov <[email protected]> Tested-by: Dmitry Baryshkov <[email protected]> # SM8350-HDK Patchwork: https://patchwork.freedesktop.org/patch/606729/ Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Abhinav Kumar <[email protected]>
1 parent d19d5b8 commit aedf02e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1171,8 +1171,6 @@ static void dpu_encoder_virt_atomic_mode_set(struct drm_encoder *drm_enc,
11711171

11721172
cstate->num_mixers = num_lm;
11731173

1174-
dpu_enc->connector = conn_state->connector;
1175-
11761174
for (i = 0; i < dpu_enc->num_phys_encs; i++) {
11771175
struct dpu_encoder_phys *phys = dpu_enc->phys_encs[i];
11781176

@@ -1270,6 +1268,8 @@ static void dpu_encoder_virt_atomic_enable(struct drm_encoder *drm_enc,
12701268

12711269
dpu_enc->commit_done_timedout = false;
12721270

1271+
dpu_enc->connector = drm_atomic_get_new_connector_for_encoder(state, drm_enc);
1272+
12731273
cur_mode = &dpu_enc->base.crtc->state->adjusted_mode;
12741274

12751275
dpu_enc->wide_bus_en = dpu_encoder_is_widebus_enabled(drm_enc);

0 commit comments

Comments
 (0)