dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] drm/msm/atomic: Clean up planes in the error paths of .atomic_commit()
@ 2015-05-27 11:39 Laurent Pinchart
  2015-05-27 11:40 ` [PATCH 2/2] drm: rcar-du: " Laurent Pinchart
  2015-05-27 19:09 ` [PATCH 1/2] drm/msm/atomic: " Rob Clark
  0 siblings, 2 replies; 3+ messages in thread
From: Laurent Pinchart @ 2015-05-27 11:39 UTC (permalink / raw)
  To: dri-devel

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(-)

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

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH 2/2] drm: rcar-du: Clean up planes in the error paths of .atomic_commit()
  2015-05-27 11:39 [PATCH 1/2] drm/msm/atomic: Clean up planes in the error paths of .atomic_commit() Laurent Pinchart
@ 2015-05-27 11:40 ` Laurent Pinchart
  2015-05-27 19:09 ` [PATCH 1/2] drm/msm/atomic: " Rob Clark
  1 sibling, 0 replies; 3+ messages in thread
From: Laurent Pinchart @ 2015-05-27 11:40 UTC (permalink / raw)
  To: dri-devel; +Cc: linux-sh

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/rcar-du/rcar_du_kms.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/rcar-du/rcar_du_kms.c b/drivers/gpu/drm/rcar-du/rcar_du_kms.c
index 20859aae882e..226a7e368b59 100644
--- a/drivers/gpu/drm/rcar-du/rcar_du_kms.c
+++ b/drivers/gpu/drm/rcar-du/rcar_du_kms.c
@@ -495,8 +495,10 @@ static int rcar_du_atomic_commit(struct drm_device *dev,
 
 	/* Allocate the commit object. */
 	commit = kzalloc(sizeof(*commit), GFP_KERNEL);
-	if (commit == NULL)
-		return -ENOMEM;
+	if (commit == NULL) {
+		ret = -ENOMEM;
+		goto error;
+	}
 
 	INIT_WORK(&commit->work, rcar_du_atomic_work);
 	commit->dev = dev;
@@ -519,7 +521,7 @@ static int rcar_du_atomic_commit(struct drm_device *dev,
 
 	if (ret) {
 		kfree(commit);
-		return ret;
+		goto error;
 	}
 
 	/* Swap the state, this is the point of no return. */
@@ -531,6 +533,10 @@ static int rcar_du_atomic_commit(struct drm_device *dev,
 		rcar_du_atomic_complete(commit);
 
 	return 0;
+
+error:
+	drm_atomic_helper_cleanup_planes(dev, state);
+	return ret;
 }
 
 /* -----------------------------------------------------------------------------
-- 
Regards,

Laurent Pinchart

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/2] drm/msm/atomic: Clean up planes in the error paths of .atomic_commit()
  2015-05-27 11:39 [PATCH 1/2] drm/msm/atomic: Clean up planes in the error paths of .atomic_commit() Laurent Pinchart
  2015-05-27 11:40 ` [PATCH 2/2] drm: rcar-du: " Laurent Pinchart
@ 2015-05-27 19:09 ` Rob Clark
  1 sibling, 0 replies; 3+ messages in thread
From: Rob Clark @ 2015-05-27 19:09 UTC (permalink / raw)
  To: Laurent Pinchart; +Cc: dri-devel@lists.freedesktop.org

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
>
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-05-27 19:09 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-05-27 11:39 [PATCH 1/2] drm/msm/atomic: Clean up planes in the error paths of .atomic_commit() Laurent Pinchart
2015-05-27 11:40 ` [PATCH 2/2] drm: rcar-du: " Laurent Pinchart
2015-05-27 19:09 ` [PATCH 1/2] drm/msm/atomic: " Rob Clark

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).