diff mbox

drm/prime: fix up handle_to_fd ioctl return value

Message ID 1372749519-3266-1-git-send-email-daniel.vetter@ffwll.ch (mailing list archive)
State New, archived
Headers show

Commit Message

Daniel Vetter July 2, 2013, 7:18 a.m. UTC
In

commit da34242e5e0638312130f5bd5d2d277afbc6f806
Author: YoungJun Cho <yj44.cho@samsung.com>
Date:   Wed Jun 26 10:21:42 2013 +0900

    drm/prime: add return check for dma_buf_fd

the failure case handling was fixed up. But in the case when we
already had the buffer exported it changed the return value:
Previously we've return 0 on success, now we return the fd.

This ABI change has been caught by i-g-t/prime_self_import/with_one_bo.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=66436
Cc: YoungJun Cho <yj44.cho@samsung.com>
Cc: Seung-Woo Kim <sw0312.kim@samsung.com>
Cc: Kyungmin Park <kyungmin.park@samsung.com>
Tested-by: lu hua <huax.lu@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
---
 drivers/gpu/drm/drm_prime.c |    7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

Comments

YoungJun Cho July 2, 2013, 7:55 a.m. UTC | #1
Dear Daniel,

On Jul 2, 2013 4:19 PM, "Daniel Vetter" <daniel.vetter@ffwll.ch> wrote:
>
> In
>
> commit da34242e5e0638312130f5bd5d2d277afbc6f806
> Author: YoungJun Cho <yj44.cho@samsung.com>
> Date:   Wed Jun 26 10:21:42 2013 +0900
>
>     drm/prime: add return check for dma_buf_fd
>
> the failure case handling was fixed up. But in the case when we
> already had the buffer exported it changed the return value:
> Previously we've return 0 on success, now we return the fd.
>
> This ABI change has been caught by i-g-t/prime_self_import/with_one_bo.
>
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=66436
> Cc: YoungJun Cho <yj44.cho@samsung.com>
> Cc: Seung-Woo Kim <sw0312.kim@samsung.com>
> Cc: Kyungmin Park <kyungmin.park@samsung.com>
> Tested-by: lu hua <huax.lu@intel.com>
> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
> ---
>  drivers/gpu/drm/drm_prime.c |    7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/drm_prime.c b/drivers/gpu/drm/drm_prime.c
> index 52709f2..1e0de41 100644
> --- a/drivers/gpu/drm/drm_prime.c
> +++ b/drivers/gpu/drm/drm_prime.c
> @@ -347,10 +347,13 @@ int drm_gem_prime_handle_to_fd(struct drm_device
*dev,
>  out_have_obj:
>         get_dma_buf(dmabuf);
>         ret = dma_buf_fd(dmabuf, flags);
> -       if (ret < 0)
> +       if (ret < 0) {
>                 dma_buf_put(dmabuf);
> -       else
> +       } else {
>                 *prime_fd = ret;
> +               ret = 0;
> +       }
> +
>         goto out;
>
>  fail_rm_handle:
> --
> 1.7.10.4
>
>

Right, that's my mistake.
I'll pay attention from now on!

Thank you & best regards YJ
Daniel Vetter July 2, 2013, 8:13 a.m. UTC | #2
On Tue, Jul 02, 2013 at 04:55:16PM +0900, YoungJun Cho wrote:
> Dear Daniel,
> 
> On Jul 2, 2013 4:19 PM, "Daniel Vetter" <daniel.vetter@ffwll.ch> wrote:
> >
> > In
> >
> > commit da34242e5e0638312130f5bd5d2d277afbc6f806
> > Author: YoungJun Cho <yj44.cho@samsung.com>
> > Date:   Wed Jun 26 10:21:42 2013 +0900
> >
> >     drm/prime: add return check for dma_buf_fd
> >
> > the failure case handling was fixed up. But in the case when we
> > already had the buffer exported it changed the return value:
> > Previously we've return 0 on success, now we return the fd.
> >
> > This ABI change has been caught by i-g-t/prime_self_import/with_one_bo.
> >
> > Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=66436
> > Cc: YoungJun Cho <yj44.cho@samsung.com>
> > Cc: Seung-Woo Kim <sw0312.kim@samsung.com>
> > Cc: Kyungmin Park <kyungmin.park@samsung.com>
> > Tested-by: lu hua <huax.lu@intel.com>
> > Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
> > ---
> >  drivers/gpu/drm/drm_prime.c |    7 +++++--
> >  1 file changed, 5 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/drm_prime.c b/drivers/gpu/drm/drm_prime.c
> > index 52709f2..1e0de41 100644
> > --- a/drivers/gpu/drm/drm_prime.c
> > +++ b/drivers/gpu/drm/drm_prime.c
> > @@ -347,10 +347,13 @@ int drm_gem_prime_handle_to_fd(struct drm_device
> *dev,
> >  out_have_obj:
> >         get_dma_buf(dmabuf);
> >         ret = dma_buf_fd(dmabuf, flags);
> > -       if (ret < 0)
> > +       if (ret < 0) {
> >                 dma_buf_put(dmabuf);
> > -       else
> > +       } else {
> >                 *prime_fd = ret;
> > +               ret = 0;
> > +       }
> > +
> >         goto out;
> >
> >  fail_rm_handle:
> > --
> > 1.7.10.4
> >
> >
> 
> Right, that's my mistake.
> I'll pay attention from now on!
> 
> Thank you & best regards YJ

Reviewed-by ?

Cheers, Daniel
YoungJun Cho July 2, 2013, 8:25 a.m. UTC | #3
Dear Daniel,

On Jul 2, 2013 5:14 PM, "Daniel Vetter" <daniel@ffwll.ch> wrote:
>
> On Tue, Jul 02, 2013 at 04:55:16PM +0900, YoungJun Cho wrote:
> > Dear Daniel,
> >
> > On Jul 2, 2013 4:19 PM, "Daniel Vetter" <daniel.vetter@ffwll.ch> wrote:
> > >
> > > In
> > >
> > > commit da34242e5e0638312130f5bd5d2d277afbc6f806
> > > Author: YoungJun Cho <yj44.cho@samsung.com>
> > > Date:   Wed Jun 26 10:21:42 2013 +0900
> > >
> > >     drm/prime: add return check for dma_buf_fd
> > >
> > > the failure case handling was fixed up. But in the case when we
> > > already had the buffer exported it changed the return value:
> > > Previously we've return 0 on success, now we return the fd.
> > >
> > > This ABI change has been caught by
i-g-t/prime_self_import/with_one_bo.
> > >
> > > Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=66436
> > > Cc: YoungJun Cho <yj44.cho@samsung.com>
> > > Cc: Seung-Woo Kim <sw0312.kim@samsung.com>
> > > Cc: Kyungmin Park <kyungmin.park@samsung.com>
> > > Tested-by: lu hua <huax.lu@intel.com>
> > > Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>

Reviewed-by: YoungJun Cho <yj44.cho@samsung.com>

Thank you and best regards YJ

> > > ---
> > >  drivers/gpu/drm/drm_prime.c |    7 +++++--
> > >  1 file changed, 5 insertions(+), 2 deletions(-)
> > >
> > > diff --git a/drivers/gpu/drm/drm_prime.c b/drivers/gpu/drm/drm_prime.c
> > > index 52709f2..1e0de41 100644
> > > --- a/drivers/gpu/drm/drm_prime.c
> > > +++ b/drivers/gpu/drm/drm_prime.c
> > > @@ -347,10 +347,13 @@ int drm_gem_prime_handle_to_fd(struct drm_device
> > *dev,
> > >  out_have_obj:
> > >         get_dma_buf(dmabuf);
> > >         ret = dma_buf_fd(dmabuf, flags);
> > > -       if (ret < 0)
> > > +       if (ret < 0) {
> > >                 dma_buf_put(dmabuf);
> > > -       else
> > > +       } else {
> > >                 *prime_fd = ret;
> > > +               ret = 0;
> > > +       }
> > > +
> > >         goto out;
> > >
> > >  fail_rm_handle:
> > > --
> > > 1.7.10.4
> > >
> > >
> >
> > Right, that's my mistake.
> > I'll pay attention from now on!
> >
> > Thank you & best regards YJ
>
> Reviewed-by ?
>
> Cheers, Daniel
> --
> Daniel Vetter
> Software Engineer, Intel Corporation
> +41 (0) 79 365 57 48 - http://blog.ffwll.ch
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel
diff mbox

Patch

diff --git a/drivers/gpu/drm/drm_prime.c b/drivers/gpu/drm/drm_prime.c
index 52709f2..1e0de41 100644
--- a/drivers/gpu/drm/drm_prime.c
+++ b/drivers/gpu/drm/drm_prime.c
@@ -347,10 +347,13 @@  int drm_gem_prime_handle_to_fd(struct drm_device *dev,
 out_have_obj:
 	get_dma_buf(dmabuf);
 	ret = dma_buf_fd(dmabuf, flags);
-	if (ret < 0)
+	if (ret < 0) {
 		dma_buf_put(dmabuf);
-	else
+	} else {
 		*prime_fd = ret;
+		ret = 0;
+	}
+
 	goto out;
 
 fail_rm_handle: