[bug report] drm/amd/display: disable CRTCs with NULL FB on their primary plane (V2)

Dan Carpenter dan.carpenter at oracle.com
Thu Mar 15 08:28:12 UTC 2018


Hello Shirish S,

The patch 36cc549d5986: "drm/amd/display: disable CRTCs with NULL FB
on their primary plane (V2)" from Feb 28, 2018, leads to the
following static checker warning:

	drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:4827 dm_atomic_check_plane_state_fb()
	error: 'crtc_state' dereferencing possible ERR_PTR()

drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c
  4811  static int dm_atomic_check_plane_state_fb(struct drm_atomic_state *state,
  4812                                            struct drm_crtc *crtc)
  4813  {
  4814          struct drm_plane *plane;
  4815          struct drm_crtc_state *crtc_state;
  4816  
  4817          WARN_ON(!drm_atomic_get_new_crtc_state(state, crtc));
  4818  
  4819          drm_for_each_plane_mask(plane, state->dev, crtc->state->plane_mask) {
  4820                  struct drm_plane_state *plane_state =
  4821                          drm_atomic_get_plane_state(state, plane);
  4822  
  4823                  if (IS_ERR(plane_state))
  4824                          return -EDEADLK;
  4825  
  4826                  crtc_state = drm_atomic_get_crtc_state(plane_state->state, crtc);
                        ^^^^^^^^^^
  4827                  if (crtc->primary == plane && crtc_state->active) {
                                                      ^^^^^^^^^^^^^^^^^^
  4828                          if (!plane_state->fb)
  4829                                  return -EINVAL;
  4830                  }
  4831          }
  4832          return 0;
  4833  }


regards,
dan carpenter


More information about the amd-gfx mailing list