MLK-21489 drm/imx: dpu: kms: Return properly in case we fail to get plane state to...
authorLiu Ying <victor.liu@nxp.com>
Thu, 18 Apr 2019 08:34:05 +0000 (16:34 +0800)
committerLiu Ying <victor.liu@nxp.com>
Fri, 19 Apr 2019 07:51:19 +0000 (15:51 +0800)
We should return properly in case we fail to get plane state to check.
For example, a race condition on the plane state would happen when one
thread does page flip and another thread updates CRTC properties on
that CRTC simultaneously.  '-EDEADLK' should be returned when the
condition occurs.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
(cherry picked from commit 2ab36051b74c49f66bb12d8d8086e6e6b3dc069b)

drivers/gpu/drm/imx/dpu/dpu-kms.c

index 485ff96..07e68bc 100644 (file)
@@ -604,6 +604,9 @@ static int dpu_drm_atomic_check(struct drm_device *dev,
 
                drm_for_each_plane_mask(plane, dev, crtc_state->plane_mask) {
                        plane_state = drm_atomic_get_plane_state(state, plane);
+                       if (IS_ERR(plane_state))
+                               return PTR_ERR(plane_state);
+
                        dpstate = to_dpu_plane_state(plane_state);
                        fb = plane_state->fb;
                        dpu_plane = to_dpu_plane(plane);