hc
2024-01-03 2f7c68cb55ecb7331f2381deb497c27155f32faf
kernel/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
....@@ -682,7 +682,10 @@
682682 if (crtc->state)
683683 dpu_crtc_destroy_state(crtc, crtc->state);
684684
685
- __drm_atomic_helper_crtc_reset(crtc, &cstate->base);
685
+ if (cstate)
686
+ __drm_atomic_helper_crtc_reset(crtc, &cstate->base);
687
+ else
688
+ __drm_atomic_helper_crtc_reset(crtc, NULL);
686689 }
687690
688691 /**
....@@ -831,6 +834,8 @@
831834 struct drm_rect crtc_rect = { 0 };
832835
833836 pstates = kzalloc(sizeof(*pstates) * DPU_STAGE_MAX * 4, GFP_KERNEL);
837
+ if (!pstates)
838
+ return -ENOMEM;
834839
835840 if (!state->enable || !state->active) {
836841 DPU_DEBUG("crtc%d -> enable %d, active %d, skip atomic_check\n",
....@@ -1257,6 +1262,8 @@
12571262 struct drm_crtc *dpu_crtc_init(struct drm_device *dev, struct drm_plane *plane,
12581263 struct drm_plane *cursor)
12591264 {
1265
+ struct msm_drm_private *priv = dev->dev_private;
1266
+ struct dpu_kms *dpu_kms = to_dpu_kms(priv->kms);
12601267 struct drm_crtc *crtc = NULL;
12611268 struct dpu_crtc *dpu_crtc = NULL;
12621269 int i;
....@@ -1288,7 +1295,8 @@
12881295
12891296 drm_crtc_helper_add(crtc, &dpu_crtc_helper_funcs);
12901297
1291
- drm_crtc_enable_color_mgmt(crtc, 0, true, 0);
1298
+ if (dpu_kms->catalog->dspp_count)
1299
+ drm_crtc_enable_color_mgmt(crtc, 0, true, 0);
12921300
12931301 /* save user friendly CRTC name for later */
12941302 snprintf(dpu_crtc->name, DPU_CRTC_NAME_SIZE, "crtc%u", crtc->base.id);