nouveau: fix screen creation failure paths
authorBen Skeggs <bskeggs@redhat.com>
Thu, 26 Nov 2015 04:34:43 +0000 (14:34 +1000)
committerBen Skeggs <bskeggs@redhat.com>
Tue, 22 Dec 2015 03:24:05 +0000 (13:24 +1000)
commit323d4da372298900ce02293a682ba563ac29f4cb
treeb1c88e2101f095fdff42e86c28d066313b297283
parent6c1bfff66ca6dd9dac11507889ee17987bed31cb
nouveau: fix screen creation failure paths

The winsys layer would attempt to cleanup the nouveau_device if screen
init failed, however, in most paths the pipe driver would have already
destroyed it, resulting in accesses to freed memory etc.

This commit fixes the problem by allowing the winsys to detect whether
the pipe driver's destroy function needs to be called or not.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Tested-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
src/gallium/drivers/nouveau/nouveau_screen.c
src/gallium/drivers/nouveau/nv30/nv30_screen.c
src/gallium/drivers/nouveau/nv50/nv50_screen.c
src/gallium/drivers/nouveau/nvc0/nvc0_screen.c
src/gallium/winsys/nouveau/drm/nouveau_drm_winsys.c