[Nouveau] [PATCH] drm/nouveau: don't hold spin lock while calling kzalloc with GFP_KERNEL

Pekka Paalanen pq at iki.fi
Mon Feb 8 03:45:38 PST 2010

On Mon, 8 Feb 2010 12:02:01 +0100
Maarten Maathuis <madman2003 at gmail.com> wrote:

> Thanks for pointing that out, is it preferred to use goto style
> failure or just stick the spin unlock everywhere where you return?

In this particular case, just add the unlock where it is needed.
But, keep in mind what might happen, if something else accesses
the things protected by the lock just between you releasing it and
the cleanup function acquiring it.

I believe the goto-style is the preferred way of doing it, but
that would mean rewriting a lot of code, since IMO the calls to
nouveau_channel_free() in the case of nouveau_channel_alloc()
are already non-goto-style. And the functions are very long to
begin with, this would only make them even longer.

Not worth to rewrite it all, unless you find yourself contemplating on
adding parameters like 'bool is_already_locked' to cleanup functions.


Pekka Paalanen

More information about the Nouveau mailing list