[Nouveau] [PATCH] drm/nouveau: fix error handling in core/core object creation functions

Ben Skeggs skeggsb at gmail.com
Mon Oct 8 17:05:15 PDT 2012


On Tue, Oct 09, 2012 at 12:50:59AM +0200, Marcin Slusarz wrote:
> On Mon, Oct 08, 2012 at 11:05:33AM +1000, Ben Skeggs wrote:
> > On Mon, Oct 08, 2012 at 12:49:31AM +0200, Marcin Slusarz wrote:
> > > Signed-off-by: Marcin Slusarz <marcin.slusarz at gmail.com>
> > > ---
> > > This patch relies on "drm/nouveau: remove >1 sclass support from nouveau_parent_create_".
> > > 
> > > There are *many* *more* code paths without proper error handling -
> > This is *not* a bug.  An object's constructor should be called via
> > nouveau_object_ctor(), which has the semantics that the constructor
> > returns and error *and* a pointer returned via pobject, then the
> > class's destructor will be called to cleanup.
> 
> That's... clever, and crazy, and unlike anything in kernel land...
Yep, I know.  It made sense to me, rather than having two copies of the
destructor code, one of them filled with gotos :)

> 
> Please put a comment near ctor field in nouveau_ofuncs to make this
> information easier to discover, without need to review the whole call chain...
Alright, I'll do something to that effect.  I have been adding comments
as I go to some WIP stuff I have going on too.

Ben.
> 
> Marcin


More information about the Nouveau mailing list