[PATCH v2] drm/gem: fix not to assign error value to gem name

Chris Wilson chris at chris-wilson.co.uk
Fri Jun 28 01:08:26 PDT 2013


On Fri, Jun 28, 2013 at 01:15:43PM +0900, 김승우 wrote:
> > Being pedantic, ret == 0 is also an error - but a programming error
> > leading to an object leak. BUG_ON(ret == 0) ?
> > 
> 
> It seems that idr_alloc() with start id 1 does not return 0, so IMHO,
> ret == 0 can be ignored here.

Yes, it is an impossible condition, hence the suggestion of a BUG_ON().
It is a paranoid check for whether idr_alloc() fails.
 
> But if you think it needs to consider programming error, I'll add some
> assertion. Please let me know.

Successfully setting obj->name = 0 would lead to interesting confusion
in userspace, and very difficult to debug. Given that, maybe it would be
better to BUG in the kernel. If you do feel like adding it, submit it as
a separate patch, so that it is not caught up with the bugfix.
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre


More information about the dri-devel mailing list