diff mbox

[1/2] drm/msm/atomic: Clean up planes in the error paths of .atomic_commit()

Message ID 1432726786-15906-1-git-send-email-laurent.pinchart@ideasonboard.com (mailing list archive)
State Accepted
Headers show

Commit Message

Laurent Pinchart May 27, 2015, 11:39 a.m. UTC
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>
---
 drivers/gpu/drm/msm/msm_atomic.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

Comments

Rob Clark May 27, 2015, 7:09 p.m. UTC | #1
On Wed, May 27, 2015 at 7:39 AM, Laurent Pinchart
<laurent.pinchart@ideasonboard.com> wrote:
> 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().

Thanks, I'll send that w/ my pull req for 4.2

BR,
-R

>
> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> ---
>  drivers/gpu/drm/msm/msm_atomic.c | 12 +++++++++---
>  1 file changed, 9 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/msm/msm_atomic.c b/drivers/gpu/drm/msm/msm_atomic.c
> index 5b192128cda2..55d4973c476a 100644
> --- a/drivers/gpu/drm/msm/msm_atomic.c
> +++ b/drivers/gpu/drm/msm/msm_atomic.c
> @@ -187,8 +187,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:
> @@ -221,7 +223,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;
>         }
>
>         /*
> @@ -265,4 +267,8 @@ int msm_atomic_commit(struct drm_device *dev,
>         complete_commit(c);
>
>         return 0;
> +
> +error:
> +       drm_atomic_helper_cleanup_planes(dev, state);
> +       return ret;
>  }
> --
> Regards,
>
> Laurent Pinchart
>
diff mbox

Patch

diff --git a/drivers/gpu/drm/msm/msm_atomic.c b/drivers/gpu/drm/msm/msm_atomic.c
index 5b192128cda2..55d4973c476a 100644
--- a/drivers/gpu/drm/msm/msm_atomic.c
+++ b/drivers/gpu/drm/msm/msm_atomic.c
@@ -187,8 +187,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:
@@ -221,7 +223,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;
 	}
 
 	/*
@@ -265,4 +267,8 @@  int msm_atomic_commit(struct drm_device *dev,
 	complete_commit(c);
 
 	return 0;
+
+error:
+	drm_atomic_helper_cleanup_planes(dev, state);
+	return ret;
 }