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