Skip to contentSkip to conversation

drm/msm/dpu: don't access mode pointer before it is set

PATCH In review Dmitry Baryshkov 2 participants 2 messages May 2, 2022

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/msm/dpu: don't access mode pointer before it is set

Move the initializer for the mode variable to the declaration point to remove unitialized variable access from the DEBUG_DPU macro. This fixes the following warning:

drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_wb.c:250:37: note: initialize the variable 'mode' to silence this warning

Fixes d7d0e73f7de3 ("drm/msm/dpu: introduce the dpu_encoder_phys_* for writeback")
---
 drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_wb.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_wb.c +1 -2
index f4a79715a02e..4829d1ce0cf8 100644
@@ -247,7 +247,7 @@ static int dpu_encoder_phys_wb_atomic_check(
 		struct drm_connector_state *conn_state)
 {
 	struct drm_framebuffer *fb;
-	const struct drm_display_mode *mode;
+	const struct drm_display_mode *mode = &crtc_state->mode;
 
 	DPU_DEBUG("[atomic_check:%d, \"%s\",%d,%d]\n",
 			phys_enc->wb_idx, mode->name, mode->hdisplay, mode->vdisplay);
@@ -256,7 +256,6 @@ static int dpu_encoder_phys_wb_atomic_check(
 		return 0;
 
 	fb = conn_state->writeback_job->fb;
-	mode = &crtc_state->mode;
 
 	if (!conn_state || !conn_state->connector) {
 		DPU_ERROR("invalid connector state\n");
Signature · 1 line
2.35.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 9 lines · Dmitry Baryshkov

Move the initializer for the mode variable to the declaration point to remove unitialized variable access from the DEBUG_DPU macro. This fixes the following warning:

drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_wb.c:250:37: note: initialize the variable 'mode' to silence this warning

Fixes d7d0e73f7de3 ("drm/msm/dpu: introduce the dpu_encoder_phys_* for writeback")

Thanks,

Quoted 25 lines
---
  drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_wb.c | 3 +--
  1 file changed, 1 insertion(+), 2 deletions(-)
drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_wb.c +1 -2
index f4a79715a02e..4829d1ce0cf8 100644
@@ -247,7 +247,7 @@ static int dpu_encoder_phys_wb_atomic_check(
  		struct drm_connector_state *conn_state)
  {
  	struct drm_framebuffer *fb;
-	const struct drm_display_mode *mode;
+	const struct drm_display_mode *mode = &crtc_state->mode;
 
  	DPU_DEBUG("[atomic_check:%d, \"%s\",%d,%d]\n",
  			phys_enc->wb_idx, mode->name, mode->hdisplay, mode->vdisplay);
@@ -256,7 +256,6 @@ static int dpu_encoder_phys_wb_atomic_check(
  		return 0;
 
  	fb = conn_state->writeback_job->fb;
-	mode = &crtc_state->mode;
 
  	if (!conn_state || !conn_state->connector) {
  		DPU_ERROR("invalid connector state\n");