drm/msm/atomic: Clean up planes in the error paths of .atomic_commit()
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Wed, 27 May 2015 11:39:46 +0000 (14:39 +0300)
committerRob Clark <robdclark@gmail.com>
Thu, 11 Jun 2015 17:11:05 +0000 (13:11 -0400)
When the .atomic_commit() handler fails, clean up planes previoulsy
prepared by drm_atomic_helper_prepare_planes() with a call to
drm_atomic_helper_cleanup_planes().

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Rob Clark <robdclark@gmail.com>
drivers/gpu/drm/msm/msm_atomic.c

index 84c0a72b446b884380fec12f4613562c247a1ab6..b421c843c9df4911ac83ee3bf74fd2baf998e703 100644 (file)
@@ -213,8 +213,10 @@ int msm_atomic_commit(struct drm_device *dev,
                return ret;
 
        c = commit_init(state);
-       if (!c)
-               return -ENOMEM;
+       if (!c) {
+               ret = -ENOMEM;
+               goto error;
+       }
 
        /*
         * Figure out what crtcs we have:
@@ -247,7 +249,7 @@ int msm_atomic_commit(struct drm_device *dev,
        ret = start_atomic(dev->dev_private, c->crtc_mask);
        if (ret) {
                kfree(c);
-               return ret;
+               goto error;
        }
 
        /*
@@ -291,4 +293,8 @@ int msm_atomic_commit(struct drm_device *dev,
        complete_commit(c);
 
        return 0;
+
+error:
+       drm_atomic_helper_cleanup_planes(dev, state);
+       return ret;
 }