[Intel-gfx] [PATCH] drm/syncobj: Stop reusing the same struct file for all syncobj -> fd

Chris Wilson chris at chris-wilson.co.uk
Thu Dec 21 07:51:41 UTC 2017


Quoting Dave Airlie (2017-12-21 02:42:56)
> > @@ -494,12 +473,11 @@ static int drm_syncobj_fd_to_handle(struct drm_file *file_private,
> >         spin_unlock(&file_private->syncobj_table_lock);
> >         idr_preload_end();
> >
> > -       if (ret < 0) {
> > -               fput(syncobj->file);
> > -               return ret;
> > -       }
> > -       *handle = ret;
> > -       return 0;
> > +       if (ret > 0)
> > +               *handle = ret;
> > +
> > +       fput(file);
> > +       return ret;
> >  }
> 
> This chunk breaks stuff, since it now returns the handle in ret if >
> 0, whereas before
> it returned 0.

So much for trying to squeeze it into single point of return.
Do we prefer return ret; or ret = 0 ?
-Chris


More information about the dri-devel mailing list